Sup /g/, I need some help with a very basic powershell script.
I need to trim a string to make something more "pretty" for a coworker.
Right now my script is...
$Server = Read-Host -Prompt 'Enter IP'
$Results = Get-WmiObject -Class Win32_Desktop -ComputerName $Server | select-string -pattern "Name"
$Results
pause
and the output of this looks like...
\\HOSTNAME\root\cimv2:Win32_Desktop.Name="NT AUTHORITY\\SYSTEM"
\\HOSTNAME\root\cimv2:Win32_Desktop.Name="NT AUTHORITY\\LOCAL SERVICE"
\\HOSTNAME\root\cimv2:Win32_Desktop.Name="NT AUTHORITY\\NETWORK SERVICE"
\\HOSTNAME\root\cimv2:Win32_Desktop.Name="DOMAINNAME\\DomainUser1"
\\HOSTNAME\root\cimv2:Win32_Desktop.Name="DOMAINNAME\\DomainUser2"
\\HOSTNAME\root\cimv2:Win32_Desktop.Name="DOMAINNAME\\DomainUser3"
I'd like the output to only be the part between the quotes, any suggestions?