Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Powershell and remote registry

$
0
0
I'm running into an issue where I can't access the following registry key remotely, either via Powershell or xp_regread. I can see it in Regedit or with powershell when I'm logged onto the box. This isn't on all servers but it does happen on the ones I'm more interested in. If I back the key up to "Microsoft SQL Server" I can get sub keys but not all are listed and it lists a couple that aren't actually there. Any idea what's going on?[quote]$MachineName = "server"$type = [Microsoft.Win32.RegistryHive]::LocalMachine$regkey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($type, $MachineName)$basePath = "SOFTWARE\\Microsoft\\Microsoft SQL Server\\Instance Names\\SQL"$regKey = $regKey.OpenSubKey($basePath)$regKey.GetSubKeyNames()Foreach($val in $regKey.GetValueNames()){ Write-Host $val.PadRight(30) -nonewline Write-Host $regKey.GetValue("$val")}[/quote]

Viewing all articles
Browse latest Browse all 467

Latest Images

Trending Articles



Latest Images