Couple quesions, runing get-qadcomputer to get the description and managed by throws an error - "get-qadcomputer" is not recognized as a cmd. Also, adding the windows license status works for the 2008 servers, but the 2003 servers uses a different -class, how can i tell it to differentiate between both operating systems?
$InventoryCSVb = "D:\Powershell\Inventory\code_testing_inventory\code_testing_inventoryb.csv"
$RemoteServerSessions = "D:\Powershell\Inventory\code_testing_inventory\RemoteSrvSessions.txt"
$Block = {
$OperatingSystem = gwmi win32_operatingsystem
$ComputerSystem = gwmi win32_computersystem
$TimeZone = gwmi Win32_TimeZone
$NIC = gwmi win32_NetworkAdapterConfiguration | where {$_.IPEnabled -eq "True"} | select IPAddress
$License = gwmi SoftwareLicensingProduct | Where-Object {$_.productkeyid -ne $null} | select LicenseStatus
$ManagedBy = Get-QADComputer -searchroot 'site' | select ManagedBy
#$License = gwmi Win32_WindowsProductActivation
$Description =
$Properties=@{
Name = $OperatingSystem.CSName
OperatingSystem = $OperatingSystem.Caption
ServicePack= $OperatingSystem.CSDVersion
PhysicalMemory = [math]::round($ComputerSystem.TotalPhysicalMemory/1GB)
NumberOfProcessors = $ComputerSystem.NumberOfProcessors
LastBootTIme = $OperatingSystem.ConvertToDateTime($OperatingSystem.LastBootupTime)
IPAddress = $NIC.IPAddress
TimeZone = $TimeZone.Caption
LicenseStatus = $License.LicenseStatus
ManagedBy = $ManagedBy.ManagedBy
Description
}
New-Object PsObject -Property $Properties
}
$sessions = Get-QADComputer -searchroot 'site' | `
Where-Object { $_.description -notlike "ClusterResource*" -and $_.description -notlike "Disaster*" -and $_.accountisdisabled -eq $False -and $_.description -notlike "*Decom?" } | `
ForEach-Object { new-pssession -ComputerName $_.Name
}
Invoke-Command -ScriptBlock $block -Session $sessions | Select 'Name','OperatingSystem', 'ServicePack','PhysicalMemory','NumberOfProcessors','LastBootTime','TimeZone','IPAddress','LicenseStatus','ManagedBy','Description' | Export-Csv $InventoryCSVb -NoTypeInformation
$sessions | Remove-PSSession
2 CSV files - combine into one CSV
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: 2 CSV files - combine into one CSV
THiss started as a simple question about combining CSV files. You are now asking for extensive consulting services.
I am sorry but a forum is not an appropriate place to get free consulting. If this is a critical project I recommend that you hire a consultant to help you work through these things.
I am sorry but a forum is not an appropriate place to get free consulting. If this is a critical project I recommend that you hire a consultant to help you work through these things.
Re: 2 CSV files - combine into one CSV
Thanks, Ive poked around the forums and see you contribute quite a lot here, with the same cause of the questions. Im sure your work is commended on this site.