# Unable able to run remote Powershell using Active Directory

We are trying to connect to a remote server via Powershell and use the ActiveDirectory module. When trying to do this locally, everything seems to be fine.

PS C:\Users\bar> Import-Module ActiveDirectory

DistinguishedName : CN=Foo Baz,OU=baz.myhost.com,OU=FooMachine,DC=foo,DC=blah,DC=loc
Enabled           : True
GivenName         : Baz
Name              : Foo Baz
ObjectClass       : user
ObjectGUID        : <some guid>
SamAccountName    : baz
Surname           : Baz
UserPrincipalName : baz@foo


When we do the samething remotely, we are not so lucky.

C:\> Enter-PSSession -ComputerName 172.1.2.3 -Credential foo\bar
[172.1.2.3]: PS C:\Users\bar\Documents> Import-Module ActiveDirectory
WARNING: Error initializing default drive: 'Unable to contact the server. This
may be because this server does not exist, it is currently down, or it does not
have the Active Directory Web Services running.'.
Unable to contact the server. This may be because this server does not exist, i
t is currently down, or it does not have the Active Directory Web Services runn
ing.
+ CategoryInfo          :
+ FullyQualifiedErrorId : Unable to contact the server. This may be becaus
e this server does not exist, it is currently down, or it does not have th
e Active Directory Web Services running.,Microsoft.ActiveDirectory.Managem

[172.1.2.3]: PS C:\Users\bar\Documents>


Christopher, we have 2 - 2008 R2 domain controllers running in that domain. The active directory web service is running on both ( "Import-Module ActiveDirectory" works fine on the server console - it is not a domain controller by the way

-

Would CREDSSP be required in this scenario anyone?

-

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:

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

-
 The AD module is installed on the server and works, but only when you execute it while RDP'd into the box. – Mark Nov 17 '10 at 21:05 What kind of Domain Controllers are you running? I think the part about not being on 2008R2 is more relevant than just the module being installed. – Christopher Nov 17 '10 at 21:33 The domain controller is 2008 R2 as is the server we are remoting into from a Windows 7 box. – Mark Nov 17 '10 at 21:48

you connected to the server using an IP address. This way, Kerberos cannot be used to authenticate (which is why you had to use credentials). So when the server tries to authenticate on your behalf, you run into a second hop issue. The server cannot hand over the credentials to a 3rd party, thus you get errors.

Your scenario requires that you connect the client via Kerberos to the server. This is only possible if your client is domain member and you use the server name and not its ip address.

Tobias www.powershell.com

-
 Even using the server name we still get the same error on the Import-Module ActiveDirectory call. – Mark Nov 17 '10 at 22:00