I'm struggling to figure out what is going on here.
I'm trying to add a domain user to a VM's local administrators group via this:
$localAdminBlock = `
$objUser = [ADSI]("WinNT://domain/domainaccount")
$objGroup = [ADSI]("WinNT://$vm/Administrators")
Invoke-Command -ComputerName $vm -Scriptblock $localAdminBlock -Credential $adminCreds
I receive an error:
"Processing data from remote server TestServer failed with the following error message: The request for the Windows Remote Shell with ShellId <id here> failed because the shell was not found on the server. Possible causes are: the specified ShellId is incorrect or the shell no longer exists on the server. Provide the correct ShellId or create a new shell and retry the operation..."
Any idea what's going on?