Anyone any ideas why I might be having an issue with an invoke-command:
invoke-command -computername SERVER -filepath c:\scripts\script.ps1
I get the error:
Invoke-Command: Object reference not set to an instance of an object.
When running as a post request script. It runs fine under any other circumstances it seems. Doesn’t make a difference if I run the CTW service as a domain-admin (for testing). ‘SERVER’ is an AD joined server, I have another invoke-command in the same script that runs fine on a non-AD server.
I can only imagine it is a credentials issue but seems to work outside CTW.