This PowerShell script can be used to collect computer information from Active Directory. I am searching only Windows XP and Windows 7 machines. You can update these values by modifying $OS1 and $OS2 variables.
$OS1 = "Windows 7*"
$OS2 = "Windows XP*"
This script is schedule to run everyday. That is the reason I have include a backup file location and a file copy process.
$BKlocation = "E:\Scripts\Win7\Report_Backups"
$Verify = Test-path -PathType Container $BKlocation
If ($Verify -eq $false)
{$Verify = New-Item -ItemType Directory -Path $BKlocation }
move-item "E:\Scripts\Win7\win*.txt" $BKlocation –Force
I am currently collecting only the following information. You can add more details based on your requirement.
$tName = $ItemProp.name
$tOS = $ItemProp.operatingsystem
$tSP = $ItemProp.operatingsystemservicepack
$tDes = $ItemProp.description
$tLoc = $ItemProp.distinguishedname
$tBuild = $ItemProp.operatingsystemversion
Script:
In my case, I am using an input file which contains the Distinguished Name of the OU. You don't have to use an input file, if you are searching an entire Domain.
2 comments:
Thanks for the help! I'm studying astronomy, right now I collect information about Mars https://solarstory.net/planets/mars. And astronomy calculations take lots of time and storage. Such scripts can help to optimize these processes.
Thanks for the help! I'm studying astronomy, right now I collect information about Mars https://solarstory.net/planets/mars. And astronomy calculations take lots of time and storage. Such scripts can help to optimize these processes.
Post a Comment