Unable able to run remote Powershell using Active Directory
Solution 1:
Would CREDSSP be required in this scenario anyone?
Solution 2:
Here is an example of using CredSSP to solve a similar problem. I tested this out, and it works to resolve the AD Web Services error you posted in your question.
To summarize from the article, first you need to enable CredSSP on both the client and server.
On the client: Enable-WSManCredSSP -Role Client -DelegateComputer [computer name] -Force
On the server: Enable-WSManCredSSP -Role Server –Force
Next you need to get or make the credential to connect to the other machine and create a session that uses that credential. Then you can use Invoke-Command
to run your PowerShell commands/script in a script block in that new session. Here is a partial example from the article, using the commands from your question:
$credential = Get-Credential -Credential iammred\administrator
$session = New-PSSession -cn SQL1.Iammred.Net -Credential $credential -Authentication Credssp
Invoke-Command -Session $session -ScriptBlock { Import-Module ActiveDirectory; Get-ADUser 'baz' }
However, this interactively asks you for your credentials, so if you want to avoid that, you'll need to do something like this for $credential
instead:
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "DOMAIN\username",$pass;
where $pass
is a secure string of the password associated with the account.
Solution 3:
I had the same issue with couple of our environments and what worked was a firewall change. Apparently ADWS uses port 9389 which was not allowed from the server that was trying to remote ly administer the DC using powershell. Once we allowed the port, everything is working smooth.
Solution 4:
From this link - http://social.technet.microsoft.com/Forums/en/winserverpowershell/thread/094f9dd3-669a-4bea-9f81-f2ea009384d1
To use the AD module, in addition to having a Server 2008 R2 or Windows 7 machine with the AD PowerShell module, if you're not running Server 2008 R2 AD servers, you will need this:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=008940c6-0296-4597-be3e-1d24c1cf0dda
If you go with a Server 2003 or 2008 AD server with the above add-on, you will still need a Server 2008 R2 or Windows 7 system to be able to utilize the AD module. Using PowerShell remoting, you would be able to use any system with PowerShell v2 installed to call the AD module cmdlets remotely, as outlined here:
http://concentratedtech.com/item/view/id/340