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")...