Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Adding Account to Admin Group Remotely - Http 500

$
0
0

Hi all,

I'm writing a PowerShell script that will automatically set up a build machine VM.

Right now I'm stuck on adding a domain user to the local administrator's group on the VM:

$localAdminBlock = `
{
	$objUser = [ADSI]("WinNT://mydomain/buildmaster")
	$objGroup = [ADSI]("WinNT://$using:vm/Administrators")
	$objGroup.PSBase.Invoke("Add",$objUser.PSBase.Path)
}

Invoke-Command -ComputerName $vm -Scriptblock $localAdminBlock -Credential $preDomainCreds

When I run this, I get:

[TestVM] Processing data from remote server TestVM failed with the following error message: The WinRM client received an HTTP server error status (500), but the remote service did not include any other information about the cause of the failure.... CategoryInfo: OpenError (TestVM:String) [], PSRemotingTransportException   FullyQualifiedErrorId: WinRMHttpError,PSSessionStateBroken

I've looked around, but all I can see about http 500 in this context is all Exchange-related.

Thanks!


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>