I am putting together a PowerShell Script which is working, but I just need help with one tiny element if I may. Let me show you...
Script
# Update PC Descritpions.ps1
# v1.0
# J-D06-Produce
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
Import-Csv .\computer_desc.csv | ForEach {
$OSValues = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $_.Server
$OSValues.Description = $_.Description
""
write-host "Old Description $OSValues"
(gwmi win32_operatingsystem -computer $_.Server).description
$OSValues.Put() >$null 2>&1
""
write-host "New Description $OSValues"
(gwmi win32_operatingsystem -computer $_.Server).description
}
It loops through a CSV file to iterate new computer descriptions against computer names. I always like to improve the output in the console window for the user so its easy to see what's happening. The Current output Is very close to how I want it...have a look
Old Description \\MUNGO-BONGO\root\cimv2:Win32_OperatingSystem=@
GP-B83409-EGTON CLINIC RM 1
New Description \\MUNGO-BONGO\root\cimv2:Win32_OperatingSystem=@
test1
Old Description \\NECS0983DRTY\root\cimv2:Win32_OperatingSystem=@
GP-B83409-EGTON CLINIC RM 2
New Description \\NECS0983DRTY\root\cimv2:Win32_OperatingSystem=@
test2
Old Description \\ELITE-DESKTOP\root\cimv2:Win32_OperatingSystem=@
GP-B83409-EGTON CLINIC RM 3
New Description \\ELITE-DESKTOP\root\cimv2:Win32_OperatingSystem=@
test3
So, I can see the PC name, the old description and what its been changed to. However if possible I want rid of this "\root\cimv2:Win32_OperatingSystem=@" to make it neater. Something similar to ...
Old Description for MUNGO-BONGO
GP-B83409-EGTON CLINIC RM 1
New Description for MUNGO-BONGO
test1
Old Description for NECS0983DRTY
GP-B83409-EGTON CLINIC RM 2
New Description for NECS0983DRTY
test2
Old Description for ELITE-DESKTOP
GP-B83409-EGTON CLINIC RM 3
New Description for ELITE-DESKTOP
test3
Many thanks in advance for any suggestions.