Jump to content

Nathan Plant

Member
  • Posts

    5
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About Nathan Plant

Nathan Plant's Achievements

0

Reputation

  1. Hmmm.. well, it still fails at the same line, which is where the WIN32_Bios class is first called. So I'm thinking that I'll go to my backup method for the project at hand (folks want this done soon), and then try to learn more about the environment and how to make it more efficient later. Thanks again, IcemanND for the help. Hopefully one day I can return the favor. -Nathan
  2. Thanks again. I'll give it a try that way, and see what happens. I'm rebooting after the mini-setup anyway, so it should be fine.
  3. I've been reading up on this stuff, and finally getting the time to incorporate the script into my sysprep routine, but I'm running into another problem now, and I'm lost as to the trouble. I'm including the script above (minus the user-interactive parts, since it's supposed to be largely unattended) in the cmdlines.txt for Sysprep use (called by a batch file that uses "cscript <scriptname.vbs>" as it's only line). When Sysprep executes the script, I get the following error. "C:\Sysprep\i386\$oem$>rencomp.vbs (17,1) SWbemServicesEx: Critical Error" I've searched and tried to understand what is happening here, and I figure it has to do with the Mini Setup I'm running, but I don't know enough about the environment in which this script is running to know for sure if there's a problem there or not. The script runs perfectly when logged in as an administrator, by the way. My easy solution is to include the batch file that runs the script in the "run_once_GUI" section of the Sysprep ini, but then I'll have to leave something behind (like a batch file that doesn't go anywhere). I'd rather have things clean themselves up, but I'll live with it if it's all I can get. Thanks for the referral to the Scripting Guys, too. I've been reading a lot of stuff there. -Nathan
  4. IcemanND - That worked well. And much more elegant than my newbie code, I must say. I stripped out the message boxes so that the user doesn't have to interface unless there's an error, and added the CompanyName string like you mentioned, and it's a hit. Thanks again for the help! Now... to get a book or two to get more into it. -Nathan
  5. I'm very new to this, so please bear with me as I'm learning the terminology. The goal: To use Sysprep with an answer file to restore an image to a new PC, without having to baby-sit the process. This would include renaming the computer based on the "SerialNumber" field in the BIOS. The problem: I've got a simple VB script already that will pull the SerialNumber from the BIOS, but now I can't figure out how to use the information to rename the system. Specifically, the computer name will need to be "CompanyName-SerialNumber". Is there an easy way to perform the rename within the same script that I use to pull the SerialNumber out of the BIOS? Note: I don't need to join these computers to a domain - this is for preparing multiple systems for a customer who will use them stand-alone. My existing script that pulls the SerialNumber is below. Right now, I have it set to port the output to a text file, and one of our developers wrote a little program to parse the file and rename the computer, but this is not as elegant as I think it could be. Since I don't know how to write script yet, I pieced this together from Scriptomatic and some samples from the Web. Script: filePath = "C:\" filePrefix = "ID" fileExt = ".txt" Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile(filePath & filePrefix & fileExt) arrComputers = Array(".") For Each strComputer In arrComputers Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems objFile.WriteLine objItem.SerialNumber Next Next Function WMIDateStringToDate(dtmDate) WScript.Echo dtm: WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _ Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _ & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2)) End Function Thanks in advance for any help, Nathan
×
×
  • Create New...