How can I use PowerShell to make remote registry changes?

后端 未结 3 1387
梦如初夏
梦如初夏 2020-12-21 13:27

I have tested the following PowerShell registry settings and it sets them correctly. Could someone show me the way to do this for a remote computer?

New-Item         


        
3条回答
  •  Happy的楠姐
    2020-12-21 14:02

    Use this as example:

    $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computername ) 
            $regKey= $reg.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",$true) 
            $regKey.SetValue("New_Valuename_String","New_Valuedata",[Microsoft.Win32.RegistryValueKind]::String) 
    

    To create a new key you need use powershell remoting with invoke-command for new-item cmdlet.

提交回复
热议问题