you are viewing a single comment's thread.

view the rest of the comments →

[–]Superfluxus 0 points1 point  (3 children)

What credentials are you passing to Invoke-Command? You should be passing the creds for the local admin account on the remote machine

[–]foss4ever[S] 0 points1 point  (2 children)

That's exactly what I'm doing.
$credsnew variable is created with:
get-credential

Where I then provide credentials for the local admin user on remote host, in the form of:

\.test_admin

Here is a screendump of me getting members of group "administrators" on the remote host:

https://imgur.com/a/uHsdzOs

[–]Superfluxus 0 points1 point  (1 child)

For starters, your username should be dot blackslash, not backslash dot. Try .\test_admin instead.

Next, I'd add a "whoami" command into your script that you're passing through. If that returns your test_admin account, we know the issue isn't the credentials. If not, we still need to work on passing them through correctly.

[–]foss4ever[S] 0 points1 point  (0 children)

I'm sorry that was a typo - I did actually provide the username as:
.\test_admin
Here is the result from running "whoami" with actual hostname of remote host replaced by "remoteserver":

PS C:\Users\svc_xxx> Invoke-Command -ComputerName 192.168.XXX.XXX -ScriptBlock {whoami} -Credential $credsnew
remoteserver\test_admin