Ability to connect to explicit DC

Topics: Developer Forum, User Forum
Aug 25, 2009 at 11:46 PM

PSCX seems to have istalled just fine. (at least no reported errors)

doing a get-psdrive reveals the GAC drive

But, there is no directoryServices drive.

I am thinking that this is because the domain that I am connected to is NOT the domain that my Windows Vista notebook is actually in (I am always at some customer's location and rarely on my own company lan)

I looked through all the settings installed in the profile.ps1 file, but none of them allow for pointing to an explicit domain that is not the one the OS is in.

This seems like a good feature to add :)




Aug 26, 2009 at 1:48 AM

We no longer initialize the DirectoryServices drive by default.  We got complaints that it was noticeably slowing the loading of folks profiles.  You can add it via your profile by adding in something like this:

New-PSDrive -Name <driveName> -PSProvider DirectoryServices -Root "DC=<your-domain>,DC=com"

Note: You may need to supply to supply the Credential parameter along with credentials.

Aug 26, 2009 at 3:23 AM
Edited Aug 26, 2009 at 3:37 AM


I was able to create the drive as you suggested:

new-psdrive -credential $cred -description "BC AD" -name "bcad" -Scope Global -psprovider DirectoryServices -root "DC=bluecanyon,DC=com"

however, trying to access it id not work very well:

cd bcad:

results in:

Test-Path : The specified domain either does not exist or could not be contacted.
At C:\Program Files\PowerShell Community Extensions\Profile\Cd.ps1:185 char:19
+                     if (test-path <<<<  $path -type leaf) {
    + CategoryInfo          : NotSpecified: (:) [Test-Path], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.TestPathComman

Set-Location : The specified domain either does not exist or could not be contacted.
At C:\Program Files\PowerShell Community Extensions\Profile\Cd.ps1:188 char:18
+                     Set-Location <<<<  $path -ErrorAction Stop
    + CategoryInfo          : NotSpecified: (:) [Set-Location], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.SetLocationCom


I know for some of the other AD oriented cmdlets, I have to specify the domain controller server name to get them to work.

so, i'm thinking that pscx is trying to use auto-discovery of the DC server, and that does not work?

might need the abilit to set/specify DC server to use also.

Note that the following does correctly return the list of DCs available:

get-domaincontroller -credential $cred -domain bluecanyon.com




Sep 5, 2009 at 5:39 AM

Robert, what happens if you try:

Set-Location bcad:
Jul 14, 2012 at 12:33 AM

I know this is a very old thread, but I'm having this exact same issue.  I see in another forum that this method works, but it's not working for me.


Specifically, my computer is not a member of a domain.  When I take it to a client site and I try to connect to the customer's windows 2003 domain I get the exact same results as those posted by rgsiii.

Running the 'set-location' command gives the same results as the 'cd' alias.

PS C:\temp> set-location hncorp:
Set-Location : The specified domain either does not exist or could not be contacted.
At line:1 char:13+ set-location <<<<  hncorp:    + CategoryInfo          : NotSpecified: (:) [Set-Location], COMException    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.SetLocationCom   mand
PS hncorp:\> 

You can see that it does go to the hncorp: psdrive, gci didn't work - and I dind't test much of anything esle.