Welcome to Powergui.org - an open source community for Windows Powershell

PowerGUI.org PowerGUI.org and blogs

Forums » Active Directory and PowerShell

Thread: connect-qadservice issues

This question is not answered. Helpful answers available: 2. Answered answers available: 1.


Permlink Replies: 5 - Pages: 1 - Last Post: Nov 24, 2009 11:27 AM by: Altimeter
DanPotter

Posts: 5
Registered: 5/7/09
connect-qadservice issues
Posted: Oct 21, 2009 6:41 AM
 
  Click to reply to this thread Reply

Hi All,

I've browsed every google result I could find on connect-qadservice and still drawing a blank.

Just a little script to test.

$pw = read-host "Enter password" -AsSecureString

 connect-QADService -service DC:389 -ConnectionAccount domain\myaccount -ConnectionPassword $pw


Get-QADGroupMember -Identity "domain\domain admins" -type user

disconnect-qadservice

and the result is.

[PS] C:\Users\>C:\gp\Untitled1.ps1
Enter password: *********

DefaultNamingContext                               Type
--------------------                               ----
DC=domain,DC=com                       ActiveDirectory


Get-QADGroupMember : The specified domain either does not exist or could not be contacted. (Exception from HRESULT: 0x8
007054B)
At C:\gp\Untitled1.ps1:6 char:19
+ Get-QADGroupMember <<<<  -Identity "domain\domain admins" -type user
    + CategoryInfo          : NotSpecified: (:) [Get-QADGroupMember], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Quest.ActiveRoles.ArsPowerShellSnapIn.Powers
   hell.Cmdlets.GetGroupMemberCmdlet


As you can see it is connecting to the dc successfully then returning domain doesn't exist.
note there is no trust, I am running this from my laptop to one of my developement domains.

alternatively, if i run the cmd targeting the domain i'm currently sitting on it works. from the articles I read this shouldn't happen. They say all requests subsequent to connect-qadservice and before disconnect should target the connected dc. stumped.

appreciate any advice.  Dan




DanPotter

Posts: 5
Registered: 5/7/09
Re: connect-qadservice issues
Posted: Oct 23, 2009 4:59 AM   in response to: DanPotter
 
  Click to reply to this thread Reply

no one has ever had this problem?


BenDE

Posts: 63
Registered: 9/17/08
Re: connect-qadservice issues
Posted: Oct 24, 2009 1:27 AM   in response to: DanPotter
 
  Click to reply to this thread Reply

Hi,

i tested your Syntax, no Prob.

The Error message says, that the Domain couldn't be contacted.

Did you try the Get-QADGroupMember Syntax run seperatly?
What Message do you get, without the Connect-QADService?

Greetings
BEN



Steve_J

Posts: 6
Registered: 9/11/09
Re: connect-qadservice issues
Posted: Nov 10, 2009 12:23 PM   in response to: DanPotter
 
  Click to reply to this thread Reply

try this

$pw = read-host "Enter password" -AsSecureString

$conn = connect-QADService -service DC:389 -ConnectionAccount domain\myaccount -ConnectionPassword $pw

Get-QADGroupMember -Identity "domain\domain admins" -type user -Connection $conn

disconnect-qadservice



DanPotter

Posts: 5
Registered: 5/7/09
Re: connect-qadservice issues
Posted: Nov 24, 2009 6:35 AM   in response to: Steve_J
 
  Click to reply to this thread Reply

thanks, this works but I'm still baffled as to why the intructions say all subsequent commands target the domain you are connected to until you disconnect. If this were true it wouldn't be necessary to specify the connection along with the command




Altimeter

Posts: 12
Registered: 9/17/09
Re: connect-qadservice issues
Posted: Nov 24, 2009 11:27 AM   in response to: DanPotter
 
  Click to reply to this thread Reply

Are you running a .ps1 script to connect, and then trying to run commands?  I ran into the same problem running scripts off a box not part of the domain.  Ensure that you dot source your script.  If you don't, the variables inside the script are destroyed once the script finishes execution.  You need to type a period, a space, and then your script path.


Listing connect.ps1:
###
$cred = Get-Credential
Connect-QADService 'mydc.mydomain.org' -Credential $cred
###


[PS] C:\>.\connect.ps1

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential

DefaultNamingContext                               Type
--------------------                               ----
DC=mydomain,DC=org                             ActiveDirectory


[PS] C:\>Get-QADUser jsmith
Get-QADUser : The specified domain either does not exist or could not be contacted. (Exception from HRESULT: 0x8007054B
)
At line:1 char:12
+ Get-QADUser <<<<  jsmith
    + CategoryInfo          : NotSpecified: (:) [Get-QADUser], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Quest.ActiveRoles.ArsPowerShellSnapIn.Powers
   hell.Cmdlets.GetUserCmdlet

[PS] C:\> . .\connect.ps1

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential

DefaultNamingContext                               Type
--------------------                               ----
DC=mydomain,DC=org                             ActiveDirectory


[PS] H:\ps\filecluster>Get-QADUser jsmith

Name                           Type            DN
----                           ----            --
Smith, John                    user            <stripped>



Legend
MVP: 2501 + pts
Guru: 2001 - 2500 pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums