Yassine Wasti
Yassine Wasti

Reputation: 11

Adding authentication to PowerShell command

I'm running the following PowerShell command:

$colDisks = get-wmiobject Win32_LogicalDisk 
    -ComputerName $strComputer
    -Filter "DriveType = 3"

But I'm not having enough privileges to run this command for remote servers.

How can I add an authentification to this command to have more privileges?

Upvotes: 0

Views: 188

Answers (1)

CB.
CB.

Reputation: 60938

try

$colDisks = get-wmiobject Win32_LogicalDisk
    -ComputeNname $strComputer
    -Filter "DriveType = 3"
    -Credential (get-credential)

Upvotes: 2

Related Questions