Saturday, July 11, 2009

KiXtart: Customize OEM Support Information


? "[OEMSupportTag].....: Configuring OEM Support applet..."
Dim $oeminfo, $oemlogo, $oemsupp, $x, $regkey
Dim $logfile, $oemlogosrc, $oemsuppsrc
Dim $wmi, $wmi_compsys, $wmi_comp, $model, $desc, $asset
$weblink = "https://intranet.company.com/helpdesk"

$regkey = "HKLM\System\CurrentControlSet\Control\Windows"
$value = ReadValue($regkey,"SystemDirectory")
$windir = ExpandEnvironmentVars($value)

If $windir <> ""
$oeminfo = $windir+"\oeminfo.ini"
$oemlogo = $windir+"\oemlogo.bmp"
$oemsupp = $windir+"\web\support.htm"
$logfile = $windir+"\custom_oem.ini"
$oemlogosrc = @lserver+"\netlogon\oemlogo.bmp"
$oemsuppsrc = @lserver+"\netlogon\support.htm"

If Exist( $oeminfo ) = 1
? "[OEMSupportTag].....: removing existing oeminfo.ini file..."
Del( $oeminfo )
Else
? "[OEMSupportTag].....: no existing oeminfo.ini file found."
EndIf

? "[OEMSupportTag].....: attempting to create new oeminfo.ini file..."
If Open(2, $oeminfo, 5) = 0
? "[OEMSupportTag].....: file created successfully, updating contents..."
$wmi = "WINMGMTS:{IMPERSONATIONLEVEL=IMPERSONATE}!//"+@wksta
$wmi_compsys = "SELECT * FROM Win32_ComputerSystemProduct"
$wmi_comp = GetObject($wmi).ExecQuery($wmi_compsys)
For Each $objsys In $wmi_comp
$model = $objsys.Name
$desc = $objsys.Description
$asset = $objsys.IdentifyingNumber
Next
$=WriteLine(2,"[General]" + @crlf)
$=WriteLine(2,"Manufacturer=MY COMPANY, INC." + @crlf)
$=WriteLine(2,"Model="+$model + @crlf)
$=WriteLine(2,"SupportURL=$weblink" + @crlf)
$=WriteLine(2,"LocalFile=%windir%\web\support.htm" + @crlf + @crlf)
$=WriteLine(2,"[OEMSpecific]" + @crlf)
$=WriteLine(2,"SubModel=" + @crlf)
$=WriteLine(2,"SerialNo=" + @crlf)
$=WriteLine(2,"OEM1="+$asset + @crlf)
$=WriteLine(2,"OEM2=" + @crlf + @crlf)
$=WriteLine(2,"[ICW]" + @crlf)
$=WriteLine(2,"Product=Computer Asset" + @crlf + @crlf)
$=WriteLine(2,"[Support Information]" + @crlf)
$=WriteLine(2,"Line1=COMPUTER HELP DESK" + @crlf)
$=WriteLine(2,"Line2= " + @crlf)
$=WriteLine(2,"Line3=Contact Technical Support by web or phone:" + @crlf)
$=WriteLine(2,"Line4= " + @crlf)
$=WriteLine(2,"Line5= $weblink" + @crlf)
$=WriteLine(2,"Line6= 1-800-555-1212" + @crlf)
$=WriteLine(2,"Line7= " + @crlf)
$=WriteLine(2,"Line8=After hours/weekends/holidays..." + @crlf)
$=WriteLine(2,"Line9=support options may be limited." + @crlf)
$=WriteLine(2,"Line10=------------------------------" + @crlf)
$=WriteLine(2,"Line11=Computer Name: " + @wksta + @crlf)
If Trim($asset) <> ""
$=WriteLine(2,"Line12=Asset Tag: " + Trim($asset) + @crlf)
$=WriteLine(2,"Line13=IPAddress: " + @ipaddress0 + @crlf)
Else
$=WriteLine(2,"Line12=IPAddress: " + @ipaddress0 + @crlf)
EndIf
Close(2)
? "[OEMSupportTag].....: oeminfo.ini file has been successfully updated!"
Else
? "[OEMSupportTag].....: Error: failed to create new oeminfo.ini file!"
EndIf

? "[OEMSupportTag].....: oeminfo logo graphic updated already?..."
If Exist( $logfile ) = 0
? "[OEMSupportTag].....: attempting to create new oeminfo update log file..."
If Exist( $oemlogosrc ) = 1
? "[OEMSupportTag].....: downloading oeminfo logo graphic file..."
Copy $oemlogosrc $oemlogo
If Open(3, $logfile, 5) = 0
WriteLine(3,"[General]"+@crlf)
WriteLine(3,"DateAdded="+@date+@crlf)
Close(3)
? "[OEMSupportTag].....: oeminfo log updated."
EndIf
Else
? "[OEMSupportTag].....: oeminfo graphic file missing: "+$oemlogosrc
EndIf
Else
? "[OEMSupportTag].....: "+$logfile+" previously recorded."
EndIf
Else
? "[OEMSupportTag].....: Error: windir variable not set, aborting process."
EndIf

No comments:

Post a Comment