Saturday, April 9, 2011

Search Active Directory and Get Computer Object Information

Purpose – This script searches Active Directory and report information about computer objects. 

You can modify the ObjSearch.SearchRoot filter to limit the scope to a particular OU.  Also, modify the if($TClastLogon -eq "12/31/1600 18:00:00") {[string]$TClastLogon = "Never"}  section with correct value to replace the 12/31/1600 date with Never value. 

image

Output – This script has two outputs.  It creates an output file called ComptuerInfo.csv which contains all computer information. 

image

It also generate the output on the screen as shown in the following screenshot:

image

Downloadwww.sivarajan.com

I also updated this script onto the Microsoft Script Center - http://gallery.technet.microsoft.com/scriptcenter/5c618613-9a51-402c-a4b9-edccd06ba8d9

12 comments:

It’s really an interesting fact which I just got to know via this blog. Making this blog and keeping it updated is the best possible thing which customer always ask for. So I would like to thank for this interesting knowledge given by the moderator!
http://www.hpd530.com

I am getting a blank file..it creates the columns with the names but does not actually pull the information.

Something wrong with your input file or the script. Post the input file and script here.

how can I incorporate the request of Lastlogin user for each machine?

http://portal.sivarajan.com/2010/07/user-profile-and-os-info-powershell.html

Lastlogin user – You can check the profile update date. Take a look at my following script:

http://portal.sivarajan.com/2010/07/user-profile-and-os-info-powershell.html

Hi, how can im odify the code to also export the GUID/UUID string to the file?

How I can get information about memory?

sivarajan ,

Thanks for the script i wan to understand what does
if($TClastLogon -eq "12/31/2011 18:00:00") {[string]$TClastLogon = "Never"}
if($TClastLogoff -eq "12/13/1600 18:00:00") {[string]$TClastLogoff = "Never"}

means in simple terms

replaces the variable with "never" if equals (matches) the date

I am getting error while running this script against 2012AD. The error is...

Exception calling "FindAll" with "0" argument(s): "An operations error occurred
.
"
At C:\Intelex_Corporate_IT\Scripts\SearchAD_ComputerInfo.ps1:16 char:29
+ $AllObj = $objSearch.FindAll <<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

Computer Name:
Last Log On: 12/31/1600 19:00:00
Last Loff Off: 12/31/1600 19:00:00
Distinguished Name:
Operating System:
--------------------------------------------------------------------------------
-----
PS C:\windows\system32>

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More