I am using an invoke command to pull out the WSUS service from list of server. However, for 1 server I need to use a different credential. Wondering how I can get this accomplished.
Since you have a foreach loop that iterates through the list of computers, something like this perhaps:
#creds for separate server
$creds = Get-Credential -Credential "domain\username"
foreach ($C in $computername)
{
if ($c -match "name of server with own credentials")
{
Invoke-Command -Credential $creds
}
else
{
Invoke-Command
}
}
Thanks Richard, but will this prompt for the password. I need to set this as Schedule task. I know, I am asking very basic thing here, but trying to get the hold of it.