0
votes

I have a TFSserver and a QAserver. I am using autodeployment using TFS and have a powershell script that do the requirement. But I have a issue in restarting the QA server IIS from the same power shell script. i am doing the following set of commands for restarting the IIS.

/*struser is in the administrator group of the QAserver

$cred = New-Object System.Management.Automation.PSCredential ("$QAserver$struser", $password ) $session = new-pssession $oceane_server -Auth Negotiate -Credential $cred

/* Some deployment script */

invoke-command -session $session -ScriptBlock {iisreset /stop}

Following error appears :

Access denied, you must be an administrator of the remote computer to use this

command. Either have your account added to the administrator local group of

the remote computer or to the domain administrator global group.

I could not find the solution for this. Any help would be appreciable.

1
How sure are you that the credentials that you are using is an admin on that box?MrHinsh - Martin Hinshelwood

1 Answers

0
votes

The quick work around is to open all the ports of your server and run iisreset [MACHINENAME] /stop.

For powershell remoting, I use credssp because it allows the double-hop. Also, did you set your execution policy to bypass?

Set-ExecutionPolicy Bypass