Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20396

Re: PowerShell Credentials

$
0
0

I tried the "Run the script under specified account" option and also toggled between the x86/x64 options, but still had the same "access denied" issue.

 

However, I found a workaround by using the Invoke-Command cmdlet (see below).  This gave me a method for passing credentials.  Thanks for your help.

 

$time = Invoke-Command -ComputerName ${Node.Caption} -Credential ${CREDENTIAL} -ScriptBlock {w32tm /query /source}

If ($time -eq 'Free-running System Clock')

{

  Write-host "Message:" $time;

  Write-host "Statistic: 1";

  Exit 1;

}

Else

{

  Write-host "Message:" $time;

  Write-host "Statistic: 0";

  Exit 0;

}


Viewing all articles
Browse latest Browse all 20396

Trending Articles