You are currently browsing the tag archive for the 'VBScript' tag.
This VBScript is for disabling the Fingerprint device in BIOS. It has only been tested on a few newer HP models.
‘============================================================
‘ AUTHOR: Nick Moseley , http://t3chn1ck.wordpress.com
‘ DATE : 5/29/2009
‘ COMMENT: This script is for disabling the Fingerprint Device in BIOS
‘ It has been tested on HP models – 6515b, 6535b, 2510p – but may
‘ function for other models
‘============================================================
Option Explicit
There are plenty of examples out there for how to get the most out of Task Sequences for SCCM 2007 OS deployment. But I wasn’t motivated to find out how others were doing it…Until I saw a demonstration by Jarvis Davis that he presented at MMS 2009.
From that I built my own custom HTML Application to do what I needed. At the moment, I have not enabled HTA support in my WinPE boot images. So the below example is purely a “BackEnd” script which simply means that it needs to run at the towards the end of the Task Sequence so that the end-operator (or end-user) does not need to wait for much of the imaging to complete.
This HTA does the following
- Field to enter in the name of user to add into the local Administrators group
- Selection for US time zone to configure Windows to use (defaults to MST, since that is where I am)
- Option to install one of 6 flavors of Adobe Acrobat
- Option to install one of 2 flavors of Project 2003
- Option to install one of 2 flavors of Visio 2003
- Option to install BlackBerry desktop
- Option to install Streets and Trips 2006
Additional things to note
- In order to add a domain user to your local admins group, the value sDomainName = “YourDomainName” must be filled in appropriately.
- All activity is logged into C:\CustomSystemOptions.log
- If one of the options to install software is selected, a Task Sequence variable is created and set to True. To utilize this, you would need to have an Install Software task that is limited to only install of the corresponding variable is set to True. Note: the Install Software task must be after the execution of the HTA!
Hope this is helpful!
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<title>OSD Option Choser</title>
Today I was troubleshooting some client communication problems and found that one of the causes was that they were generating bad MIFs, so SCCM was rejecting the hardware inventory they were sending. Along the way, I also found that there 230 bad MIFs on my site server. Instead of manually opening each file to ‘document’ which system it was, I decided to script it. I must give credit to a blog posting by Don Hite, which gave me the original idea to do this in the first place.
‘==========================================================================
‘ NAME: Get_BADMIFS
‘
‘ AUTHOR: Nick Moseley, http://t3chn1ck.wordpress.com
‘ DATE : 5/14/2009
‘
‘ COMMENT: Ensure the value for sSMSInbox is the UNC path to your SCCM inboxes
‘==========================================================================
Const ForReading = 1
Dim sSMSInbox, sNamePosition, bNameFound, sFileLine, sSystemName, iFileCount, oExcel, iRow
sSMSInbox = “\\ServerName\SMS_XYZ\inboxes”
Set oShell = CreateObject(“WScript.Shell”)
Set oFSO = CreateObject(“Scripting.FileSystemObject”)
One of the challenges with condensing workstation task sequences into a single task sequence is being able to distinguish between desktops and laptops as each typically has their own set of functions to perform when being imaged. One of the best ways to determine this is by querying ChassisTypes in Win32_SystemEnclosure. Unfortunately, ChassisTypes is an array value; the WQL that is used in the task sequence is limited to single values.
To work with this, add the following vbscript to a Run Command Line task. It creates a custom Task Sequence variable that can then be used to dynamically limit certain tasks to “desktops” and others to “laptops”.
‘==========================================================================
‘ NAME: SMSTSEnvChassisType.vbs
‘ AUTHOR: Nick Moseley, SCCM Administrator
‘ DATE : 4/24/2009
‘ COMMENT: Script creates custom TS variable that can be used to distinguish
‘ between a desktop and a laptop for dynamically selecting which tasks
‘ to run in the sequence. Note that the echo statements are logged in SMSTS.log
‘==========================================================================
When doing a baremetal image in SCCM OSD, the task sequences will generate a random name for the system. To define a specific name the system is to receive, use the following VBScript. It will prompt the end-operator to input a name and then it will set the TS variable “OSDComputerName”.
Add the script to the TS by adding a Run Command Line task after Partition Disk and before Apply Operating System.
' NAME: PromptForSystemName.vbs
'
' AUTHOR: Nick Moseley
' DATE : 6/1/2009
'
' COMMENT: This script will detect if the current assigned value for the computer name
' begins with MININT, indicating that this image is bare metal image. It then prompts
' the end-user to enter a new computer name.
'
' VERSION : 1.1
' 1.0 (12/08/2008)- Intial script to check if the computer name begins with
' "minint", which indicates the system was booted with CD or PXE.
' 1.1 (06/01/2009)- Added check if the computer name equals "minwinpc",
' which indicates the system was booted with USB key
In a corporate environment, distributing software can frequently be tricky. One thing that can cause the most headaches is when there are registry changes that need to be made within the HKCU hive of any or even every user. For example, Apple designed QuickTime to allow every user to decide whether or not to enable automatic updates. So this value is set in HKCU\Software\Apple Computer, Inc.\QuickTime\LocalUserPreferences\. But in a controlled environment, you really don’t want the users doing their own thing. So the package needs to be designed in such a way that edits the aforementioned registry key.
With SMS/SCCM, one could always build a script to make the change and configure the Program to run every time a user logs on. I used to do it this way, but grew tired of constantly needing to monitor that the advertisement is successful and there are not alot of failures…so I became my own thinktank to figure out a new process. What I realized is that I could use the existing WinXP registry tool (reg.exe) to make all the changes I need.
The process kind of looks like this: once there is no user logged into Windows, I run a script that
- Parses HKLM for every user profile
- Loads the discovered user’s registry hive
- Makes the HKCU change
- Unloads the user’s registry hive
- Moves onto the next profile
This even modifies the Default User’s profile so that anyone who logs onto the computer for the first time will already have this setting! Rinse. Repeat. Done.
'==========================================================================
' AUTHOR: Nick Moseley
' DATE : 04/07/2009
' COMMENT: This script will parse all User profiles on the computer, load their
' HKCU hive, then set the appropriate registry keys.
'==========================================================================
Full ScriptHKCU.vbs Code Here
Dim oFSO, oShell, oLogFile
Const cForAppending = 8
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
Set oLogFile = oFSO.OpenTextFile ("C:\CustomLog.txt", cForAppending, True)
Set oExecRun = oShell.Exec ("C:\Windows\system32\defrag.exe c: -a")
Full DiskCleanup.vbs Code Here



Recent Comments