Quantcast
Channel: Spiceworks Community - Latest topics
Viewing all articles
Browse latest Browse all 182949

get user printer information from a remote computer

$
0
0

Hi,

I'm trying to figure out how to get printer info from a remote computer per user profile.

I have some code in place, however[Microsoft.Win32.RegistryKey] part doesn't appear to work.

SID value and computer info works . But I cannot list anything. I think$userprinters = $RegKey.GetValue("connections") is incorrectly set. Any ideas?

Powershell
[string]$logonInfo=Get-WmiObject-ComputerName"$computer"-Query"select * from win32_computersystem"|select-expandpropertyUsernamewrite-host"$logonInfo"$userSID=get-aduser-server$b.ADServer-filter{samaccountname-eq"$logonInfo"}|select-expandpropertySID|select-ExpandPropertyvaluewrite-host"$userSID"$Reg=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("users","$computer")$RegKey=$Reg.OpenSubKey("$userSID\Printers\")$userprinters=$RegKey.GetValue("connections")...

Viewing all articles
Browse latest Browse all 182949

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>