Add a new multi-string value to windows registry

Not Answered This post has 0 verified answers | 6 Replies | 1 Follower

Not Ranked
4 Posts
Kit posted on 07-15-2011 10:32 AM


I currently work for a company of about 70 employees that are located throughout the USA. I need to add a multi-string value to each registry and we don't have a domain so I can't push this change out through GP.  

I am wanting to add a new multi-string value to the following location:


ValueName: AuthForwardServerList


Is there a way to create a windows powershell script to simply run on each user's desktop?

Thank you for any help!

All Replies

Top 25 Contributor
296 Posts
Microsoft MVP
Top Contributor

try this


$computer = "."  #local machine
$reg = [wmiclass]"\\$computer\root\default:StdRegprov"

$key = "SYSTEM\CurrentControlSet\Services\Webclient\parameters"

$name = "AuthForwardServerList"
$value = "","",""
$reg.SetMultiStringValue($HKLM, $key, $name, $value)


Not Ranked
4 Posts

Thank you for your help!  Although it runs, it doesn't add the new MultiStringValue to the key in the registry.  Here is the output:


__GENUS          : 2

__CLASS          : __PARAMETERS



__RELPATH        : 


__DERIVATION     : {}

__SERVER         : 

__NAMESPACE      : 

__PATH           : 

ReturnValue      : 5



Not Ranked
4 Posts

I ran the net helpmsg 5 and received a Access Denied.  I ran this as an administrator from my Desktop.  

Top 25 Contributor
296 Posts
Microsoft MVP
Top Contributor

Return code 5 means Access Denied.

The usual causes are:

  1. Your account doesn't have sufficient privileges to modify the Registry - you're not an administrator
  2. PowerShell wasn't started with elevated privileges - "Run as administrator"

On Vista and above option 2 is the usual culprit


Not Ranked
4 Posts

I was able to figure this out.


I had to right-click on the Powershell CMD --> Run As Administrator

Next I ran the Set-ExecutionPolicy to Remotesigned

After this I was able to run the script from Powershell (./script.ps1)


Thank you for your help!

Top 10 Contributor
655 Posts
Microsoft MVP
Top Contributor

You can do that without WMI as well:


PS> $key = 'Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebCl
PS> test-path $key
PS> Get-itemProperty $key

PSPath                           : Microsoft.PowerShell.Core\Registry::HKEY_LOC
PSParentPath                     : Microsoft.PowerShell.Core\Registry::HKEY_LOC
PSChildName                      : Parameters
PSProvider                       : Microsoft.PowerShell.Core\Registry
SupportLocking                   : 1
InternetServerTimeoutInSec       : 30
ServiceDllUnloadOnStop           : 1
ServerNotFoundCacheLifeTimeInSec : 60
ClientDebug                      : 0
FileSizeLimitInBytes             : 50000000
SendReceiveTimeoutInSec          : 60
LocalServerTimeoutInSec          : 15
FileAttributesLimitInBytes       : 1000000
AcceptOfficeAndTahoeServers      : 1
ServiceDebug                     : 0
BasicAuthLevel                   : 1
ServiceDll                       : C:\Windows\System32\webclnt.dll


PS> Set-itemProperty $key AuthForwardServerList -value "url1", "url2", "url3" -t
ype MultiString

Page 1 of 1 (7 items) | RSS
Copyright 2012 All rights reserved.