Acces Denied

  • Good day Experts,

    I am new to powershell and please help me.Where i work we use powershell script in sql server agent job to retrieve information that is hostname and disk drives size and free space from remote computers.All other sites are fine but now i have three sites sitting on a different domain and when i run the job in sql server agent it returns error 'Access denied'

    Part of the script is as follows

    Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" -computer $hostname.

    I was told to try create a credential object by a friend but i am not sure as he is not working with powershell.

    Thanks in advance!!

  • You can see my answer over on AskSSC for an example of how you create a credential object.

    What you would need to do is use the -Credential parameter that accompanies Get-WmiObject.

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply