hh5th Posted November 10, 2008 Share Posted November 10, 2008 Hi...Finally I can deploy xp with wds now....butI need to input an asset number while it is deploying, or user can input.XP image has been fully answered thus there is no user required to click or hit enter but I just need one entry to put in while it goes through....asset number.I just need one window poping up once asking for asset number and user types it in and that's it. WDS will finish the rest...Would there be a such script or is there a trick to sysprep....Any help will be greatly appricated... Link to comment Share on other sites More sharing options...
Tripredacus Posted November 10, 2008 Share Posted November 10, 2008 (edited) This may be something that needs to be done after the reboot or after the image is loaded. You will have write access to the drive after the image is deployed, so you can batch something together that way. The only real method I know is to use a management program, such as Altiris, which you pre-qualify the device (computer) and it labels it properly. The other option is to insert the Asset Tag into the DMI in the BIOS, which can then be read by Windows in System Information. Your logon scripts can take that number and do whatever is needed with it, such as renaming the computer.I wouldn't recommend that your users have a direct input into your inventory system. Edited November 10, 2008 by Tripredacus Link to comment Share on other sites More sharing options...
hh5th Posted November 11, 2008 Author Share Posted November 11, 2008 Thanks for that....Tripredacus.I was able to input an asset number into Dell Latitude BIOS 'Asset Tag' and windows seem to picked it up in WMI.So...I just need to find some vb script to capturing that info from WMI and use that as computer name when delploying is done.Thanks. Link to comment Share on other sites More sharing options...
Tripredacus Posted November 11, 2008 Share Posted November 11, 2008 Here's a starter. It refers to the serial number, but I am sure you can do it for the asset tag instead.http://www.msfn.org/board/scripting-comput...na-t110732.html Link to comment Share on other sites More sharing options...
hh5th Posted November 12, 2008 Author Share Posted November 12, 2008 Thank you for that...Tripredacus.I have edit the script to pick up SMBIOSAssetTag value but no joy..----------------------------------------------------------------------------------------strComputer = "."Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly)For Each objItem In colItems newComputerName = objItem.SMBIOSAssetTagNextSet colComputers = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")For Each objComputer in colComputers MsgBox "About to rename computer to: " & newComputername ErrCode = objComputer.Rename(newComputerName) If ErrCode = 0 Then MsgBox "Computer renamed correctly." Else MsgBox "Changing computer name failed. Error code: " & ErrCode End IfNext--------------------------------------------------------------------------------------------------------------------It picks up the asset number from WMI fine and it spits an error of"Changing computer name failed. Error code:87"But if I change the script to pick up serial number as computer name it works fine.I need some scripting help.... Link to comment Share on other sites More sharing options...
IcemanND Posted November 13, 2008 Share Posted November 13, 2008 What is the format of the Asset tag you are using? Can you give a couple examples? Could be invalid characters for a computer name. Can you manually rename the computer using the name you pulled from WMI? Link to comment Share on other sites More sharing options...
hh5th Posted November 13, 2008 Author Share Posted November 13, 2008 Thanks IcemanND.I'm just using standard letter and number (eg. NA12345 or NA54321) and yes, I can change to that name manually.This is what 'Hey Scripting Guy' gave me but how do I combine both to make it work..Name = "name"Password = "password"Username = "username"Set objWMIService = GetObject("Winmgmts:root\cimv2")' Call always gets only one Win32_ComputerSystem object.For Each objComputer in _ objWMIService.InstancesOf("Win32_ComputerSystem") Return = objComputer.rename(Name,Password,User) If Return <> 0 Then WScript.Echo "Rename failed. Error = " & Err.Number Else WScript.Echo "Rename succeeded." & _ " Reboot for new name to go into effect" End IfNext Link to comment Share on other sites More sharing options...
IcemanND Posted November 13, 2008 Share Posted November 13, 2008 the only difference between the modified script you already have and this one is that the scripting guys are using a username and password in the rename call. That should only be required if the machine is already part of a domain.One other thing to check is to make sure there is no space padding in the results of the SMBIOSAssetTag call.Try this as a test manully on a machine:strComputer = "."Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure", "WQL", _wbemFlagReturnImmediately + wbemFlagForwardOnly)For Each objItem In colItemsnewComputerName = objItem.SMBIOSAssetTagNextmsgbox "Asset Tag:" & newComputerName & "END"Set colComputers = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")For Each objComputer in colComputersMsgBox "About to rename computer to: " & newComputernameErrCode = objComputer.Rename(newComputerName)If ErrCode = 0 ThenMsgBox "Computer renamed correctly."ElseMsgBox "Changing computer name failed. Error code: " & ErrCodeEnd IfNextA message box should pop up with "Asset tag:<assettag>END Link to comment Share on other sites More sharing options...
hh5th Posted November 13, 2008 Author Share Posted November 13, 2008 (edited) Thanks again IcemanNDI have used your script and just as you mentioned "Asset Tag:NA12345 END" comes upWhen I click "OK" "About to rename computer to: NA12345" comes upWhen I click "OK""Changeing computer name failed. Error code: 87" comes up.Sorry....still no joy..By the way.... I'm playing with Dell Latitude D520 with these scripts. Edited November 13, 2008 by hh5th Link to comment Share on other sites More sharing options...
IcemanND Posted November 14, 2008 Share Posted November 14, 2008 You've got a space being returned from the asset tag.Try changing:ErrCode = objComputer.Rename(newComputerName)to this:ErrCode = objComputer.Rename(trim(newComputerName)) Link to comment Share on other sites More sharing options...
hh5th Posted November 16, 2008 Author Share Posted November 16, 2008 Thanks. IcemanND.That did the trick....I'm not sure why or how but..........and double check the asset tag but there is NO space....Anyway....Did I mention you're GOOD...! Thanks for all you're help... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now