Discussion:
Remote registry key permissions
(too old to reply)
UC
2008-06-20 06:20:00 UTC
Permalink
Hi

I am wondering if there is anything that I can use to get registry
permissions using powershell of a remote server. for example, how can I get
permission of one of my remote server named server01 registry key
HKLM\Software\Microsoft ?

Any help or direction will be greatly appreciated.

UC
Marco Shaw [MVP]
2008-06-21 14:23:44 UTC
Permalink
Post by UC
Hi
I am wondering if there is anything that I can use to get registry
permissions using powershell of a remote server. for example, how can I get
permission of one of my remote server named server01 registry key
HKLM\Software\Microsoft ?
Any help or direction will be greatly appreciated.
UC
What OS? Do you have Windows Remote Management (winrm) installed?
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
/\/\o\/\/ [MVP]
2008-06-23 11:43:00 UTC
Permalink
$MachineName = 'server'
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',
$MachineName)
$regKey= $reg.OpenSubKey("Software\Microsoft" )
$regkey.GetAccessControl().GetAccessRules($true,$true,
[System.Security.Principal.NTAccount])

Enjoy,
Greetings /\/\o\/\/
http://thePowerShellGuy.com
Post by Marco Shaw [MVP]
Post by UC
Hi
I am wondering if there is anything that I can use to get registry
permissions using powershell of a remote server. for example, how can I get
permission of one of my remote server named server01 registry key
HKLM\Software\Microsoft ?
Any help or direction will be greatly appreciated.
UC
What OS? Do you have Windows Remote Management (winrm) installed?
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
http://marcoshaw.blogspot.com
UC
2008-07-01 07:26:01 UTC
Permalink
Thanks /\/\o\/\/!
it works great on local machine but won't work on remote servers (wi2008 or
win2003)

here is error that comes as a result:
Exception calling "OpenRemoteBaseKey" with "2" argument(s): "Attempted to
perform an unauthorized operation."
At D:\temp\getregperm.ps1:2 char:56
+ $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey <<<<
('LocalMachine',
You cannot call a method on a null-valued expression.
At D:\temp\getregperm.ps1:4 char:25
+ $regKey= $reg.OpenSubKey <<<< ("Software\Microsoft" )
You cannot call a method on a null-valued expression.
At D:\temp\getregperm.ps1:5 char:25
+ $regkey.GetAccessControl <<<< ().GetAccessRules($true,$true,

not sure about the problem..

thanks for your help!
Post by /\/\o\/\/ [MVP]
$MachineName = 'server'
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',
$MachineName)
$regKey= $reg.OpenSubKey("Software\Microsoft" )
$regkey.GetAccessControl().GetAccessRules($true,$true,
[System.Security.Principal.NTAccount])
Enjoy,
Greetings /\/\o\/\/
http://thePowerShellGuy.com
Post by Marco Shaw [MVP]
Post by UC
Hi
I am wondering if there is anything that I can use to get registry
permissions using powershell of a remote server. for example, how can I get
permission of one of my remote server named server01 registry key
HKLM\Software\Microsoft ?
Any help or direction will be greatly appreciated.
UC
What OS? Do you have Windows Remote Management (winrm) installed?
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
http://marcoshaw.blogspot.com
/\\/\\o\\/\\/
2008-07-01 20:07:18 UTC
Permalink
Are you sure the account you started the shell with has admin rights on the
remote machine ?

Greetings /\/\o\/\/
Post by UC
Thanks /\/\o\/\/!
it works great on local machine but won't work on remote servers (wi2008 or
win2003)
Exception calling "OpenRemoteBaseKey" with "2" argument(s): "Attempted to
perform an unauthorized operation."
At D:\temp\getregperm.ps1:2 char:56
+ $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey <<<<
('LocalMachine',
You cannot call a method on a null-valued expression.
At D:\temp\getregperm.ps1:4 char:25
+ $regKey= $reg.OpenSubKey <<<< ("Software\Microsoft" )
You cannot call a method on a null-valued expression.
At D:\temp\getregperm.ps1:5 char:25
+ $regkey.GetAccessControl <<<< ().GetAccessRules($true,$true,
not sure about the problem..
thanks for your help!
Post by /\/\o\/\/ [MVP]
$MachineName = 'server'
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',
$MachineName)
$regKey= $reg.OpenSubKey("Software\Microsoft" )
$regkey.GetAccessControl().GetAccessRules($true,$true,
[System.Security.Principal.NTAccount])
Enjoy,
Greetings /\/\o\/\/
http://thePowerShellGuy.com
Post by Marco Shaw [MVP]
Post by UC
Hi
I am wondering if there is anything that I can use to get registry
permissions using powershell of a remote server. for example, how can I get
permission of one of my remote server named server01 registry key
HKLM\Software\Microsoft ?
Any help or direction will be greatly appreciated.
UC
What OS? Do you have Windows Remote Management (winrm) installed?
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
http://marcoshaw.blogspot.com
Loading...