remote access - Using Powershell to verify registry entries remotely -


i'm trying write script checks print server users on our network connecting to. that, i'm attempting check registry values listed under printer\connections. on local machine following 2 methods both work:

1)

get-childitem hkcu:\printers\connections

output:

hive: hkey_current_user\printers\connections  name                              property -----                             -------- ,,printserver,printername         guidprinter        : {guid}                                   server             : \\printserver.domain                                   provider           : win32spl.dll                                   localconnection    : 1 

2)

>> get-childitem hkcu:\printers\connections | foreach-object {get-itemproperty $_.pspath} 

and output of command is:

guidprinter     : {guid} server          : \\printserver.domain provider        : win32spl.dll localconnection : 1 pspath          : microsoft.powershell.core\registry::hkey_current_user\printers\connections\,,printservername,printername psparentpath    : microsoft.powershell.core\registry::hkey_current_user\printers\connections pschildname     : ,,printservername, printername psprovider      : microsoft.powershell.core\registry     

by themselves, neither of these implementations applied remote machines. recent attempt same information shown above off of remote machine is:

$machine = 'computername'; $reg = [microsoft.win32.registrykey]::openremotebasekey('currentuser',$machine); $regkey = $reg.opensubkey("printers\connections"); $regkey.getvaluename()  # tried following didn't think # work, grasping @ straws: # get-childitem $regkey; 

the above code returns nothing. doesn't throw error regkey returns empty string.

does know of alternative solution getting information i'm looking or see wrong in implementation above?

thanks.

it because key looking hkey current user, although correct changes each user depending on logged in, when run remotely loading hive not users. have user run it, , 1 of easiest ways through startup folder of machine , run , report without them knowing.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -