I’ve got some scripts that do things and since that version invoke-command in the scripts no longer works with accounts it used to.
example this used to work as my service account (which is a normal user on the remote server), passing the args TargetServer=Server1
param($result,$TargetServer)
Invoke-Command -ComputerName $TargetServer -ScriptBlock {
write-output $env:computername
}
Now it doesn’t (it doesn’t make it in to the scriptblock) gives Invoke-Command: Object reference not set to an instance of an object.
I assume its something to do with this, any ideas? I’ve tried all the different types and none of them work.
- Add impersonation logontype selection to powershell deployment task (see https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-logonusera?redirectedfrom=MSDN) as different logontypes are useful in different circumstances.