People,
I need some help in modifying the script below:
Get-ADComputer -Properties OperatingSystem, OperatingSystemVersion -Filter { Enabled -eq $True -and OperatingSystem -like "*Windows 10*"} -SearchBase "OU=Office Computers,DC=company,DC=com" |Where-Object { Test-Connection $_.Name -Count 1 -Quiet } | Where-Object { $_.DistinguishedName -notlike "*OU=Unused Computers,OU=Office Computers,DC=company,DC=com" } | Select Name, OperatingSystem, OperatingSystemVersion | Export-Csv C:\RESULT\Windows10.csv -NoTypeInformation -UseCulture
The script above exports all online Windows 10 in a particular OU list / result as CSV with Name, OperatingSystem and OperatingSystemVersion column to a CSV file.
How can I add two more column to the script result above from the command line below to get the Computer model and also the currrent logon name ?
Getting The computer model name
Get-WmiObject -Class Win32_ComputerSystem
Getting The computer logged on username
Get-WmiObject -Class Win32_ComputerSystem -ComputerName . -Property UserName
Thanks in advance.