Pages

Wednesday, December 7, 2011

VB Script To Set Boot Order On Dell Computers

In order to use this vbscript, you need to have the Dell Open Manage Interface software installed on the computer.

------------ Start Of Script ------------

strComputerName = "."
strNameSpace = "root/Dellomci"
strClassName = "Dell_BootDeviceSequence"

intKeyVal = 0
intBootOrder = 2

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,AuthenticationLevel=pktprivacy}\\" & strComputerName & "\root\dellomci")
Set ColSystem = objWMIService.execquery ("Select * from Dell_BootDeviceSequence")

For Each objSystem in ColSystem

 Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate,AuthenticationLevel=pktprivacy}\\" & _
 strComputerName & "/" & strNameSpace & ":" & strClassName & "=" & _
 Chr(34) & intKeyVal & Chr(34))

  intKeyVal = intKeyVal + 1

strDeviceName = objInstance.Properties_.Item("BootDeviceName").Value
 
 Select Case strDeviceName
Case "Diskette Drive"
objInstance.Properties_.Item("BootOrder").Value = 2
objInstance.Properties_.Item("Status").Value = 1
objInstance.Put_

Case "Hard Drive"
objInstance.Properties_.Item("BootOrder").Value = 3
objInstance.Properties_.Item("Status").Value = 1
objInstance.Put_

Case "CD/DVD/CD-RW Drive"
objInstance.Properties_.Item("BootOrder").Value = 4
objInstance.Properties_.Item("Status").Value = 1
objInstance.Put_

Case "Integrated NIC"
objInstance.Properties_.Item("BootOrder").Value = 1
objInstance.Properties_.Item("Status").Value = 1
objInstance.Put_

Case "USB-FDD"
objInstance.Properties_.Item("BootOrder").Value = 5
objInstance.Properties_.Item("Status").Value = 1
objInstance.Put_

Case "USB-ZIP"
objInstance.Properties_.Item("BootOrder").Value = 5
objInstance.Properties_.Item("Status").Value = 1
objInstance.Put_

Case "USB-CDROM"
objInstance.Properties_.Item("BootOrder").Value = 6
objInstance.Properties_.Item("Status").Value = 1
objInstance.Put_

Case "USB Device"
objInstance.Properties_.Item("BootOrder").Value = 7
objInstance.Properties_.Item("Status").Value = 1
objInstance.Put_

End Select

Next

------------ End Of Script ------------

No comments:

Post a Comment