|
|
|
date: Tue, 15 Mar 2005 09:38:17 -0800,
group: microsoft.public.scripting.vbscript
back
Re: Script for Q311218
Bob Williamson wrote:
> I am curious if it is possible to script the modifications referenced
> in Q311218. This is not a simple export/import of a registry key, but
> rather a modification to a key on each computer due to GUID references.
Hi
This should do it I think:
'--------------------8<----------------------
Const HKLM = &H80000002
sComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\default:StdRegProv")
sKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Linkage"
sValueName = "Bind"
oReg.GetMultiStringValue HKLM, sKeyPath, sValueName, arValues
arValuesNew = Array()
For i = 0 To UBound(arValues)
If i = 0 Then
If LCase(arValues(i)) = "\device\ndiswanip" Then
' entry is alredy first in the list, no point in continuing
Exit For
Else
' put NdisWanIp in the first element in the new array
ReDim Preserve arValuesNew(0)
arValuesNew(0) = "\Device\NdisWanIp"
End If
End If
If LCase(arValues(i)) <> "\device\ndiswanip" Then
iCountNew = UBound(arValuesNew) + 1
ReDim Preserve arValuesNew(iCountNew)
arValuesNew(iCountNew) = arValues(i)
End If
Next
If UBound(arValuesNew) > -1 Then
oReg.SetMultiStringValue HKLM, sKeyPath, sValueName, arValuesNew
End If
'--------------------8<----------------------
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
date: Tue, 15 Mar 2005 21:13:05 +0100
author: Torgeir Bakken \(MVP\)
Re: Script for Q311218
I am happy to report it seems to work fine. I am sorry to report it makes
very little sense to me!
Also, there has been an ongoing discussion regarding this matter at
isaserver.org as well as the NNTP ISA group.
http://forums.isaserver.org/ultimatebb.cgi?ubb=get_topic;f=30;t=000514#000016
Mr. Shinder, who is Mr. ISA Server in many people's books and runs the
isaserver.org site, is quite interested in contacting you regarding this
matter.
Thanks for your help on this,
Bob
"Torgeir Bakken (MVP)" wrote in message
news:Odn%23KuZKFHA.4064@tk2msftngp13.phx.gbl...
> Bob Williamson wrote:
>
>> I am curious if it is possible to script the modifications referenced
>> in Q311218. This is not a simple export/import of a registry key, but
>> rather a modification to a key on each computer due to GUID references.
> Hi
>
> This should do it I think:
>
>
> '--------------------8<----------------------
>
> Const HKLM = &H80000002
>
> sComputer = "."
>
> Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
> & sComputer & "\root\default:StdRegProv")
>
> sKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Linkage"
> sValueName = "Bind"
>
> oReg.GetMultiStringValue HKLM, sKeyPath, sValueName, arValues
>
> arValuesNew = Array()
>
> For i = 0 To UBound(arValues)
> If i = 0 Then
> If LCase(arValues(i)) = "\device\ndiswanip" Then
> ' entry is alredy first in the list, no point in continuing
> Exit For
> Else
> ' put NdisWanIp in the first element in the new array
> ReDim Preserve arValuesNew(0)
> arValuesNew(0) = "\Device\NdisWanIp"
> End If
> End If
>
> If LCase(arValues(i)) <> "\device\ndiswanip" Then
> iCountNew = UBound(arValuesNew) + 1
> ReDim Preserve arValuesNew(iCountNew)
> arValuesNew(iCountNew) = arValues(i)
> End If
> Next
>
> If UBound(arValuesNew) > -1 Then
> oReg.SetMultiStringValue HKLM, sKeyPath, sValueName, arValuesNew
> End If
>
>
> '--------------------8<----------------------
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx
date: Wed, 16 Mar 2005 08:48:04 -0800
author: Bob Williamson alias
|
|