在远程工作站上打开注册表

时间:2015-12-01 21:47:08

标签: powershell remote-access regedit

是否可以编写一个脚本,将远程工作站ID作为输入并在该工作站上打开regedit

如果你知道我的意思,它就像从EVTX获取事件日志一样。

1 个答案:

答案 0 :(得分:3)

这一直困扰着我,没有本地方式打开远程注册窗口。

但是你可以使用这种快速而肮脏的方法来实现它:

function Open-RemoteRegistry ($computerName = "127.0.0.1") {
    #add needed assemblies
    Add-Type -AssemblyName Microsoft.VisualBasic
    Add-Type -AssemblyName System.Windows.Forms

    #start regedit
    regedit

    #wait for it to start
    Start-Sleep -Seconds 1

    #activate regedit window
    [Microsoft.VisualBasic.Interaction]::AppActivate("Regedit")

    #send Alt F C
    [System.Windows.Forms.SendKeys]::SendWait("%FC")

    #wait for dialog
    Start-Sleep -Seconds 1

    #insert computer name and send enter
    [System.Windows.Forms.SendKeys]::SendWait("$computerName{ENTER}")

    #profit
}

Open-RemoteRegistry (Read-Host "Please provide computer name or IP address")