Jump to content

Asset entry while WDS deployment


Recommended Posts

Posted

Hi...

Finally I can deploy xp with wds now....but

I 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...


Posted (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 by Tripredacus
Posted

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. :angel

Posted

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.SMBIOSAssetTag

Next

Set 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 If

Next

--------------------------------------------------------------------------------------------------------------------

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....

Posted

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?

Posted

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 If

Next

Posted

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 colItems
newComputerName = objItem.SMBIOSAssetTag
Next

msgbox "Asset Tag:" & newComputerName & "END"

Set 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 If
Next

A message box should pop up with "Asset tag:<assettag>END

Posted (edited)

Thanks again IcemanND

I have used your script and just as you mentioned

"Asset Tag:NA12345 END" comes up

When I click "OK"

"About to rename computer to: NA12345" comes up

When 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 by hh5th
Posted

You've got a space being returned from the asset tag.

Try changing:

ErrCode = objComputer.Rename(newComputerName)

to this:

ErrCode = objComputer.Rename(trim(newComputerName))

Posted

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...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...