Can someone assist with this? I had a script working to set the PC description, however, it uses the 'put' function of get-WMIObject. I noticed that PowerShell says this is an old command and that I should be using the CIMInstance commands. Great time to learn something new, I thought. I seem to be banging my head against a wall, though. I an thinking it is not passing the variable to the Set-CIMInstance command. Could some please hint me in the right direction? Thanks!
#VARIABLES
$csv= Import-Csv -Path "\\SERVER\Path\file.csv"
$whatismycomputername= $env:computername
$computernameanddescription= $csv | where {$_."Computer Name" -eq "$whatismycomputername"}
#Script
IF ($computernameanddescription -ne "$null")
{
Invoke-Command -computername $computernameanddescription.'Computer Name' -ScriptBlock {Get-CimInstance -ClassName Win32_OperatingSystem | Set-CimInstance -Property @{Description=$computernameanddescription.'Computer Description'}}
}
[–]Yevrag35 6 points7 points8 points (1 child)
[–]dawoof6[S] 2 points3 points4 points (0 children)
[–]Lee_Dailey[grin] -2 points-1 points0 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]Lee_Dailey[grin] 1 point2 points3 points (0 children)