Utilizing Script to capture IP information and store in Sysprep.inf
Hello, I havecreated a package in SCCM that contains my script (Z-Sysprep_IP_Injection.wsf)and the ZTIUtility.vbs that my script utilizes.I havecopied and pasted my script below.I am attempting to take the network configuration information that a user enters into the first screen you get when deploying an OS through theLTI with SCCM. I hope everyone understands the screen I am talking about. Its the dialog to that allows a user to enter static network information. My WMI information seems to get the information correctly. It also seems to assign information to the OSDAdapter0* variables correctly. This is my main question: After I run this script in my task sequence, how do I force the OSD/task sequenceprocess to update the sysprep.inf with the information contained in the variables? I tried doing this by running ZTIGather.wsf but that didn't seem to update the sysprep.inf file. Any assistance would be greatly appreciated!!! <job id="Z-Sysprep_IP_Injection"><script language="VBScript" src="ZTIUtility.vbs"/><script language="VBScript"> '//************************************************************'//******Script Header *******'//'//Purpose: Inject IP address that users enters statically thorough WinPE wizard into sysprep.inf'//'//Usage: cscript Z-Sysprep_IP_Injection.wsf'//'//Build Version 1.0'//'//Author: Paul Goodson'//'//******End Header ********** oLogging.CreateEntry "Gathering Network Information from WMI and adding to sysprep.inf", LogTypeInfo strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") For Each objItem In colItemsstrIPAddress = Join(objItem.IPAddress, ",")strIPAddress = Split(strIPAddress, ",") strSubnet = Join(objItem.IPSubnet, ",")strSubnet = Split(strSubnet, ",")strGateway = Join(objItem.DefaultIPGateway, ",")strGateway = Split(strGateway, ",")strDNS = Join(objItem.DNSServerSearchOrder, ",")strDNS = Split(strDNS, ",")strPwins = objItem.WINSPrimaryServerstrSwins = objItem.WINSSecondaryServerNext oEnvironment.Item("OSDAdapter0EnableDHCP") = FALSEoEnvironment.Item("OSDAdapter0IPAddressList") = strIPAddress(0)oEnvironment.Item("OSDAdapter0SubnetMask") = strSubnet(0)oEnvironment.Item("OSDAdapter0Gateways") = strGateway(0)oEnvironment.Item("OSDAdapter0DNSServerList") = strDNS(0)oEnvironment.Item("OSDAdapter0WINSServerList") = strPwins </script></job>
January 29th, 2009 1:32am

Hi Paul, I'm not sure if this will help, but i'll post it anyway. I think that you must put your variables in the SMS environment variables (via Microsoft.SMS.TSEnvironment)and not in the standard Environment variables. The "How to use Task Sequence Variables in a Running Configuration Manager Task Sequence" document in the ConfigMgr SDK for more information. Hope this helps, Regards, Kennethhttp://www.techlog.org | http://www.activewin.com
Free Windows Admin Tool Kit Click here and download it now
January 29th, 2009 10:01am

Thanks Kenneth! That got me pointed in the right direction. Modified code below and now it works. strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") For Each objItem In colItemsstrIPAddress = Join(objItem.IPAddress, ",")strIPAddress = Split(strIPAddress, ",") strSubnet = Join(objItem.IPSubnet, ",")strSubnet = Split(strSubnet, ",")strGateway = Join(objItem.DefaultIPGateway, ",")strGateway = Split(strGateway, ",")strDNS = Join(objItem.DNSServerSearchOrder, ",")strDNS = Split(strDNS, ",")strPwins = objItem.WINSPrimaryServerstrSwins = objItem.WINSSecondaryServerNext SET env = CreateObject("Microsoft.SMS.TSEnvironment") env("OSDAdapter0EnableDHCP") = FALSEenv("OSDAdapter0IPAddressList") = strIPAddress(0)env("OSDAdapter0SubnetMask") = strSubnet(0)env("OSDAdapter0Gateways") = strGateway(0)env("OSDAdapter0DNSServerList") = strDNS(0)env("OSDAdapter0WINSServerList") = strPwins
January 29th, 2009 8:54pm

Hi when do i have to put the script in the ts and wich command? it's a command line? cmd.exe /c wscript Z-sysprep_IP_Injection.wsf This could be right? It says during the ts that x:\windows\Z-sysprep_IP_Injection.wsfis not avaiable Thanks
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2010 1:34pm

i put the wsf into the boot image. Now when it starts i got the error unterminated entity reference - matching ';' not found
May 28th, 2010 11:23am

THANKS!! This is exactly what I was looking for to capture the IP information in WinPE that the user inputs when they use an SCCM task sequence boot media disk to pull an Image on our network that does not have DHCP. I had to edit a few things, but it works beautifully! OSD Task sequence is now fully automated and joins the machine to the domain.
Free Windows Admin Tool Kit Click here and download it now
October 21st, 2010 11:08pm

So....I was wondering if any of you can tell me where in the TS process you run this or provide a little further instruction? I have the package created with the .vbs and .wfs and the script works fine however when I run it in the TS it either tells me I cannot run it at the point in the TS (PE Environment) and when I run it after the setup windows and config manager it loses the IP by that time and captures the APIPA address. I currently run SCCM in an environment where we do not use DHCP so this would help me out a lot, thanks in advance!
January 22nd, 2011 8:19pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics