Hi all, I have a need for the batch script and am limited in my knowledge of it. I was hoping someone could help me write it, or at least the parsing portion of it. It needs to do following:
1a. Runs "ipconfig /all" and parses out the SID# of the virtual adapter for the Check Point SecureClient we have installed. A typical output from one of our computers with Check Point SecureClient installed looks like this:
Windows IP Configuration
Host Name . . . . . . . . . . . . : Edcomm127
Primary Dns Suffix . . . . . . . : edcomm.local
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : edcomm.local
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : edcomm.local
Description . . . . . . . . . . . : Broadcom NetXtreme 57xx Gigabit Controller
Physical Address. . . . . . . . . : 00-1D-09-C5-BA-E4
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 192.168.0.147
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.251
DHCP Server . . . . . . . . . . . : 192.168.0.245
DNS Servers . . . . . . . . . . . : 192.168.0.245
192.168.0.247
Lease Obtained. . . . . . . . . . : Wednesday, August 20, 2008 3:44:45 PM
Lease Expires . . . . . . . . . . : Saturday, August 23, 2008 3:44:45 PM
Ethernet adapter Wireless Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Description . . . . . . . . . . . : Dell Wireless 1490 Dual Band WLAN Mini-Card
Physical Address. . . . . . . . . : 00-1F-3A-37-C8-0B
Ethernet adapter {5B935B46-FBE6-4587-BA4C-9
90CE75D37C
0}:
Media State . . . . . . . . . . . : Media disconnected
Description . . . . . . . . . . . : Check Point Virtual Network Adapter For SecureClient - SecuRemote Miniport
Physical Address. . . . . . . . . : 54-5F-FA-56-29-09
1b. We want the number between the brackets {} for the bottom most adapter in this example, the "Check Point Virtual Network Adapter For SecureClient". So the batch script should pull out the "5B935B46-FBE6-4587-BA4C-9
90CE75D37C
0". But some computers may have additional adapters that return SID numbers similar to that, so if there is a way to have the batch search for the "Check Point Virtual Network Adapter for SecureClient" string... and then back up a few lines and grab the SID between the brackets {}, that would be preferable.
2a. The script would then create a .reg file that would change the registry DWORD values of "RegisterAdapterName" and "RegistrationEnabled" to 1. Example code from an exported .reg below:
[HKEY_LOCAL_MACHINE\SYSTEM
\CurrentCo
ntrolSet\S
ervices\Tc
pip\Parame
ters\Inter
faces\{5B9
35B46-FBE6
-4587-BA4C
-990CE75D3
7C0}]
"RegistrationEnabled"=dwor
d:00000001
"RegisterAdapterName"=dwor
d:00000001
2b. As you can see the SID number that was retrieved earlier needs to be placed into the top line of the .reg file so the registry changes the values for the correct interface.
3. The batch script then needs to run the .reg file without any user interaction and install the changes. (/S parameter when running regedit.exe from command-line)
NOTE #1: If the registry changes can be made directly from the batch script using commands without creating a .reg file for importing, that is fine too.
NOTE #2: This link may help with using regedit within a batch script:
http://www.robvanderwoude.com/regedit.htmlStart Free Trial