Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


PowerShell to search for domain Computer objects


PowerShell to search for domain Computer objects

Author
Message
DBAFahim
DBAFahim
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 161
Comments posted to this topic are about the item PowerShell to search for domain Computer objects
aleksbor
aleksbor
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 81
Hello Fahim,

How is this different from

Get-ADComputer "RAL" | select Name, DistinguishedName | fl

?

Thank you,

AK
DBAFahim
DBAFahim
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 161
aleksbor (4/30/2013)

...
How is this different from
Get-ADComputer "RAL" | select Name, DistinguishedName | fl
...


In order to use that Cmdlet, I had to activate the ActiveDirectory feature of windows on the querying server.
Personally I wouldn't want to install the ActiveDirectory feature on my SQL Server, which is where I would be querying from, hence I'd be without the "Get-ADComputer".

I tried to import the module alone, but with no luck, maybe there is a way and I just didn't get it.

This is why I wrote that longer script that used commands already available inside my non-AD server.
aleksbor
aleksbor
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 81
I see. I usually do this sort of thing from my PC. Also, I beleive in PS V3 modules load automatically...
DBAFahim
DBAFahim
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 161
If I could get your command to work, without installing the AD feature, I'd love to get that working. I agree, my work-around is much less efficient.

Please send me instructions or details I'd love to give it a shot, and update my article.
aleksbor
aleksbor
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 81
Load one of those (depending on OS):

http://www.microsoft.com/en-in/download/details.aspx?id=34595

and run that command I posted earlier.
DBAFahim
DBAFahim
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 161
It turns out that I already had the latest version of PowerShell.
However what I needed to do was install a Windows Feature called "RSAT-AD-PowerShell", which then allowed me to run your CMDlet.

Now that I can run the Get-ADComputer cmdlet, how do you wildcard the name ? Or do I have to write that Filter wrapper in Powershell ?
aleksbor
aleksbor
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 81
You may try something of this sort:
Get-ADComputer -SearchBase "OU=Servers,OU=Computers,DC=you_domain,DC=local" -Filter *

get-help get-adcomputer -examples will show you more examples.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search