title: Configure Group Policy Object with PowerShell
body: <p>I'd like to configure GPO for multiple computers with powershell, but I'm not able to find proper command and path to GP object.
  I need to disallow users to run specific aplications by</p>
  
  <blockquote>
    <p>User Configuration > Administrative Templates > System > Don't run specified Windows application</p>
  </blockquote>
  
  <p>..and specify applications (e.g. wmplayer.exe, vlc.exe, etc.)</p>
  
  <p>What command should I use? Set-GPPrefRegistryValue or Set-GPRegistryValue?</p>
  
  <p>Thanks in advance for any hints!</p>
  
  <p>UPDATE:</p>
  
  <p>I made this script</p>
  
  <pre><code>$hostname = "hostname"
  
  $BaseKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey( 'CurrentUser' , $hostname )
  
  $SubKey_1 = $BaseKey.OpenSubKey(“Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\”,$true)
  
  $SubKey_1 = $BaseKey.CreateSubKey(“Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun”,$true)
  
  $SubKey_1 = $BaseKey.OpenSubKey(“Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\”,$true)
  
  $ValueName_1 = “DisallowRun”
  $ValueData_1 = 1
  
  #DisallowRun DWORD
  $SubKey_1.SetValue($ValueName_1, $ValueData_1, [Microsoft.Win32.RegistryValueKind]::DWORD)
  
  $SubKey_2 = $BaseKey.OpenSubKey(“Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun”,$true)
  
  #forbidden apps
  $1n = "wmplayer"
  $1v = "wmplayer.exe"
  $2n = "test1"
  $2v = "test.exe"
  $3n = "calc"
  $3v = "calc.exe"
  
  $SubKey_2.SetValue($1n, $1v, [Microsoft.Win32.RegistryValueKind]::String)
  $SubKey_2.SetValue($2n, $2v, [Microsoft.Win32.RegistryValueKind]::String)
  $SubKey_2.SetValue($3n, $3v, [Microsoft.Win32.RegistryValueKind]::String)
  </code></pre>
  
  <p>But it doesn't work for currently logged user (I can see these values only in regedit opened under my credentials on target computer).
  I also tried to made the same under LocalComputer registry - it doesn't work either.</p>
  
  <p>Any ideas?</p>