Blog

Steelooper's Blog

Dell Business Client Operating System Deployment - The .CAB Files - The Dell TechCenter (2010-03-29T11:46:00.001+02:00)

Author: Bas Steelooper

Dell Business Client Operating System Deployment - The .CAB Files - The Dell TechCenter

I was creating an 64 Bit MDT Boot image and added the WinPE 64 Bit drivers to the Boot image. The Boot image generation failed for the following drivers:
* DELL CERC SATA 1.5/6ch RAID Controller
* DELL CERC SATA 1.5/6ch RAID Management Device
* DELL PERC 5/E Adapter RAID Controller
* DELL PERC RAID Virtual Device
* Dell PERC S100 S300 Controller [storport]
* Dell SAS 5/E Adapter
* ATI AHCI Compatible RAID Controller
* Broadcom HT1000 SATA Controller(AMD64 Release)
The creation of the Boot image was successful after removal of the above drivers.

In the description it states that these are Vista Drivers. Is it possible these are not compatible with Windows7 PE?

Regards,

Bas Steelooper

The Standard Setting Session (2010-02-13T19:25:00.001+01:00)

Author: Bas Steelooper

Due to the NDA I cannot tell you what went on during the Session. But I can tell you that it is a very nice experience. I wouldn't have missed it for the world.
Also it was very nice to meet Krista for once. I had never met her in person and enjoyed meeting her.
There were 5 other SME's in the session and 4 Microsoft employees.

It started at 8:30 at which we received coupons to get breakfast. Then we started the real session, with a break at 11:45 to get some lunch (also with coupons). The session was over at 17:30 so a bit later than the other SME's had expected. They had all done this before so they did know what to expect, as I didn't.

What I thought was very good of Microsoft is the care for the environment. All materials used are compostable (Not the tin cans ofcourse, but those are recycled)

I really enjoyed being there, and being part of this session.

[update: Arrived in Redmond] No longer At the airport waiting to board........ (2010-02-10T10:15:00.002+01:00)

Author: Bas Steelooper

Today I am at the airport awaiting boarding. I am going to the United States of America and to be specific to Redmond, WA.

Yes there is the head office of Microsoft. I am invited to join a Set the Standard Session for an upcoming OS Examination. (Details are not allowed according to the NDA) I am invited since I passed the exam excellent or near excellent...

All arrangements are made, flight is booked, I cleared the security and am awaiting boarding.
At arrival in Seattle there should be a car waiting so I have some freedom driving around and seeing things. The hotel is also booked....
Tomorrow (11 feb 2010) I am expected at Microsoft at 8:30 and will be there the whole day. Friday I have some freetime to do a little sight seeing and I fly back on saturday.

I will keep you updated...

[update]
I successfully boarded and exited the plane, cleared the US Customs, and am in my hotel room now.....

I will take it easy and go to Microsoft tomorrow.....

Out of Office in outlook 2010 (2010-01-08T10:35:00.002+01:00)

Author: Bas Steelooper

A lot of people ask me how to set the "Out Of Office" in the new and improved Outlook 2010.

This is why I thought up to make a little how to. And here it is.

To set the Out of Office (Automatic Reply as is it is called now) you start Outlook 2010.

When Outlook is started you click on the yellow File button in the top left corner (See image below)


















In the new screen make sure that Info is selected on the left hand site, and then click on Automatic Replys (Out of Office) (See image below)

























In the new screen, which is similar as the Office 2007 Out Of Office Assistant screen, you can set your Automatic Reply

To do this select "Send automatic replies"

Optional: if only during a certain time frame this message must be send select "Only send during this time range:" and fill in the dates with times.

Insert your message in the "Inside My Organization" part. (This message will only be send within the same exchange organization)

Note: To send Automatic replies to people outside your organization ( for instance customers) you can add a message in the "Outside my organization" tab

71-693 - Promotion not found for the Netherlands :-( (2009-12-14T10:06:00.003+01:00)

Author: Bas Steelooper

Today we all could register for the 71-693 Exam. That is everyone with an SME profile. Disappointing it was that I set the alarmclock at 6 AM (12:00 EST) to register for the exam. Only to get the following message: Promotion not found. (In green as it must be a good thing???)
Contacted Microsoft but they didn't have a clue either... Than wait until 8 AM to call Prometric.
Prometric was very busy this morning so I was on hold for about 20 - 25 minutes before a Customer Service Representative could talk to me. But they were not able to help me with the registration :-( They escalated this, but for the moment with no result.
We have to wait until 12 PM or 1 PM before this can be resolved. And by then the slots will be full.

Helmer has also posted on his blog and several people have responded that they were unable to register.

I'll update this post if something changes.

UPDATE:
Just phoned Prometric again. Escalation is started from Europe, but the escalation seems to be only an email message to Prometric in the United States. They will start to wake up (come into the office) around 2PM (14:00 CET) and start with a cup of coffee, talk about the weekend and then read the mails about this problem. And then start to fix it. This will probably take a few hours to investigate and fix so registration must be possible around 8PM (20:00 CET). I asked them what kind of escalation process this is, but they are bound by the rules which are created in the States.
There is nothing we can do but wait....

UPDATE 2:
A colleague called me that the problem was resolved and yes I was able to register....
So where all the people who I know were stressing to register for the exam....

New version installer template Version 1.2 (2009-12-08T10:39:00.008+01:00)

Author: Bas Steelooper

Updated the installer template to a new version.
Changes are:

ADDED:
isApplicationInstalled : Check if an application is installed.
isApplicationInstalledGUID : Check if an application is installed by its Identifier.
Usefull when the Add Remove Programname is not unique
isProcessActive : Check if a process is active.
MODIFIED:
uninstallAppGUID : Fixed the exit code to be unique.

Download link: Install_Template-1.2.vbs

Changes are below:

'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2009
'
' NAME: Installer script template V1.2
' AUTHOR: Bas Steelooper , Steelooper Consulting
' DATE : 08-12-2009
'
' Modifications
' V1.1
' ADDED:
' uninstallAppGUID : Uninstall an application by its Identifier.
' Usefull when the Add Remove Programname is not unique
' MODIFIED:
' s_ForceUseCSCript : added variable forceCscriptSilent.
' If set to TRUE the script will NOT notify the end user that it is being relaunched
' s_ForceUseCSCript : WSHShell.run modified to hidden.
' When relaunched the script now doesn't show a cscript window.
'
' V1.2
' ADDED:
' isApplicationInstalled : Check if an application is installed.
' isApplicationInstalledGUID : Check if an application is installed by its Identifier.
' Usefull when the Add Remove Programname is not unique
' isProcessActive : Check if a process is active.
' MODIFIED:
' uninstallAppGUID : Fixed the exit code to be unique.
'
'==========================================================================

........

Const APPVER = "1.2"

........

Sub showHelp()
'===============================================================================
'# Purpose : show help information on how to use the script #
'# #
'# Modified in version 1.2 #
'===============================================================================

.....

If debug Then

.....

WScript.Echo vbTab & "66600005" & vbTab & " : uninstallAppGUID is called without information" 'added in version 1.2
WScript.Echo vbTab & "66600006" & vbTab & " : isProcessActive is called without information" 'added in version 1.2
WScript.Echo vbTab & "66600007" & vbTab & " : isApplicationInstalled is called without information" 'added in version 1.2
WScript.Echo vbTab & "66600008" & vbTab & " : isApplicationInstalledGUID is called without information" 'added in version 1.2
End If

.....

End Sub

.........

Function isProcessActive(objWMIService, arrProcName)
'==============================================================================================================================
'# purpose : check if the processes passed to this service are active #
'# input : objWMIService : initialised object from GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2") #
'# arrProcName : Array which contains the names of the processes to be checked #
'# String which contains one name of a process to be checked #
'# #
'# Example: arrProcName = Array("outlook", "communicator", "winword", "excel", "powerpnt", "access") #
'# isProcessActive objWMI, arrProcName  #
'#                                                                                                                            #
'# Added in version 1.2 #
'==============================================================================================================================
writeLog "starting isProcessActive", "Starting isProcessActive", "isProcessActive"
Dim colProcesses, strQuery, procName, first
strQuery = "Select * from Win32_Process where "
first = True

If IsArray( arrProcName ) Then
For Each procName In arrProcName
If Not first Then
strQuery = strQuery & "OR "
End If
strQuery = strQuery & "Name Like '%"& procName &"%' "
first = false
Next
Else
If arrProcName = "" Then
writeLog "ERROR isProcessActive", "ERROR - Started isProcessActive with no Process te check " & _
"- Terminiting script now with errorcode 66600006", "isProcessActive"
WScript.Quit (66600006)
Else
strQuery = strQuery & "Name Like '%"& arrProcName &"%' "
End if
End If

Set colProcesses = objWMIService.ExecQuery(strQuery)
Dim Process
isProcessActive = False
For Each Process In colProcesses
isProcessActive = True
Next
End Function

..........

Private Sub uninstallAppGUID( objWMIService, arrAppName )

.......

writeLog "ERROR UNINSTALL","Error uninstalling because no parameter was set. exiting with errorcode 66600005", "uninstallAppGUID" 'fixed in version 1.2

.......

End Sub

Private Function isApplicationInstalled( objWMIService, arrAppName )
'==============================================================================================================================
'# purpose : check if the applications which are given in the input are installed #
'# input : objWMIService : initialised object from GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2") #
'# arrAppName : Array which contains the names of the applications to be checked #
'# String which contains one name of a applications to be checked #
'# #
'# Example: arrCheckAppName = Array("Office 2003 Proofing", "Microsoft Office Proof", "visio viewer") #
'# isApplicationInstalled objWMI, arrCheckAppName #
'# #
'# Added in version 1.2 #
'==============================================================================================================================
writeLog "starting isApplicationInstalled","starting to run the sub isApplicationInstalled", "isApplicationInstalled"
Dim colSoftware, objSoftware, strQuery, first, strAppName
strQuery = "Select * from Win32_Product Where "
first = True
on error resume next
If IsArray( arrAppName ) Then
For Each strAppName In arrAppName
If Not first Then
strQuery = strQuery & "OR "
End If
strQuery = strQuery & "Name Like '%"& strAppName &"%' "
first = false
Next
Else
If arrAppName = "" Then
writeLog "ERROR CHECK","Error checking because no parameter was set. exiting with errorcode 66600007", "isApplicationInstalled"
WScript.Quit (66600007)
End if
strQuery = strQuery & "Name Like '%"& arrAppName &"%' "
End If
Set colSoftware = objWMIService.ExecQuery (strQuery)
on error resume next
isApplicationInstalled = False
For Each objSoftware in colSoftware
writeLog "checking application","Now checking " & objSoftware.Name, "isApplicationInstalled"
isApplicationInstalled = True
Next
on error goto 0
End Function

Private Function isApplicationInstalledGUID( objWMIService, arrAppName )
'==============================================================================================================================
'# purpose : check if the applications which are given in the input are installed #
'# input : objWMIService : initialised object from GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2") #
'# arrAppName : Array which contains the names of the applications to be checked #
'# String which contains one name of a applications to be checked #
'# #
'# Example: arrCheckAppName = Array("{34E9AA45-3D13-4DBD-8BC9-7F06AB39B090}", "{34666A45-3D13-4DBD-8BC9-7F0612345690}") #
'# isApplicationInstalledGUID objWMI, arrCheckAppName #
'# #
'# Added in version 1.2 #
'==============================================================================================================================
writeLog "starting isApplicationInstalledGUID","starting to run the sub isApplicationInstalledGUID", "isApplicationInstalledGUID"
Dim colSoftware, objSoftware, strQuery, first, strAppName
strQuery = "Select * from Win32_Product Where "
first = True

If IsArray( arrAppName ) Then
For Each strAppName In arrAppName
If Not first Then
strQuery = strQuery & "OR "
End If
strQuery = strQuery & "IdentifyingNumber = '%"& strAppName &"%' "
first = false
Next
Else
If arrAppName = "" Then
writeLog "ERROR CHECK","Error checking because no parameter was set. exiting with errorcode 66600008", "isApplicationInstalledGUID"
WScript.Quit (66600008)
End if
strQuery = strQuery & "IdentifyingNumber = '%"& arrAppName &"%' "
End If
Set colSoftware = objWMIService.ExecQuery (strQuery)
on error resume next
isApplicationInstalled = False
For Each objSoftware in colSoftware
writeLog "checking application","Now checking " & objSoftware.Name, "isApplicationInstalledGUID"
isApplicationInstalled = True
Next
on error goto 0
End Function

Use it freely if you want. But please post here if you do.

Sys internals AD Explorer bypasses security settings in AD (2009-12-07T15:42:00.004+01:00)

Author: Bas Steelooper

I recently found that the AD Explorer tool from Sysinternals has a different way of handling the display of OU structures.

In an active directory an OU is setup with security rights so that only administrators can view the contents. If you fire up Active Directory Users and Computers this won't show the contents of this folder as suspected.

Since I also use alternative tools to do thing I also us AD Explorer. Since a collegue had trouble seeing the contents of hte OU, I found that I was able to view the contents of the OU. This is strange since we have similar user rights.

I haven't found out yet why AD explorer behaves different apposed to the native tooling. Especially since Microsoft acquired Systinternals and the tools are placed on technet.

Update:
Today I was unable to access the same OU. The only thing changed is that all members are now changed with security rights to only be visible to administrators. Looks like that when an object in an OU is visible to the user, AD Explorer will open the OU to show this object (and all others)

New version installer template 1.1 (2009-12-07T12:49:00.004+01:00)

Author: Bas Steelooper

Updated the installer template to a new version.
Changes are:

ADDED:
uninstallAppGUID : Uninstall an application by is Identifier.
Usefull when the Add Remove Programname is not unique
MODIFIED:
s_ForceUseCSCript : added variable forceCscriptSilent.
If set to TRUE the script will NOT notify the end user that it is being relaunched
s_ForceUseCSCript : WSHShell.run modified to hidden.
When relaunched the script now doesn't show a cscript window.



'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2009
'
' NAME: Installer script template V1.1
' AUTHOR: Bas Steelooper , Steelooper Consulting
' DATE : 07-12-2009
'
' COMMENT: This is the installer script template
' Create a foler to hold the install sources and this script
' Following folder structure:
'
' APPLICATION-XYZ
' |------ INSTALLATION-SOURCES
' | |--- ..........
' |
' ------ install_Template.vbs
'
' Modify the following functions to your needs
' parseCommandLineArguments
' If additional commandline options are required
' showHelp
' If additional commandline options are possible describe them here
' runTask
' The installtion tasks
'
' Start from SMS/SCCM with commandline "cscript install_Template.vbs [-debug] [logfolder]"
'
' Modifications
' V1.1
' ADDED:
' uninstallAppGUID : Uninstall an application by is Identifier.
' Usefull when the Add Remove Programname is not unique
' MODIFIED:
' s_ForceUseCSCript : added variable forceCscriptSilent.
' If set to TRUE the script will NOT notify the end user that it is being relaunched
' s_ForceUseCSCript : WSHShell.run modified to hidden.
' When relaunched the script now doesn't show a cscript window.
'
'==========================================================================

'=========================
'# Constants declaration #
'=========================
Const FILENAME = "install_Template.vbs"
Const APPNAME = "Tempalte-Installer"
Const APPDESCRIPTION = "This is the installer script template"
Const APPVER = "1.1"
Const COPYYEAR = "2009"
Const AUTHOR = "Bas Steelooper"
Const COMPANYNAME = "Steelooper Consulting"

'constants for registry editing
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_PERFORMANCE_DATA = &H80000004
Const HKEY_CURRENT_CONFIG= &H80000005
Const HKEY_DYN_DATA = &H80000006

'constants for textfiles
Const FORREADING = 1
Const FORWRITING = 2
Const FORAPPENDING = 8

'constants for eventlog
Const SUCCESS = 0
Const ERRORL = 1
Const WARNING = 2
Const INFORMATION = 4

'constants for disk access
Const HARD_DISK = 3
Const CONVERT_GB = 1073741824

'Constants for MSI
const msiUILevelNoChange = 0 'Does not change UI level.
const msiUILevelDefault = 1 'Uses default UI level.
const msiUILevelNone = 2 'Silent installation.
const msiUILevelBasic = 3 'Simple progress and error handling.
const msiUILevelReduced = 4 'Authored UI and wizard dialog boxes suppressed.
const msiUILevelFull = 5 'Authored UI with wizards, progress, and errors.
const msiUILevelHideCancel = 32 'If combined with the msiUILevelBasic value, the installer shows progress dialog boxes but does not display a Cancel button on the dialog box to prevent users from canceling the installation.
const msiUILevelProgressOnly = 64 'If combined with the msiUILevelBasic value, the installer displays progress dialog boxes but does not display any modal dialog boxes or error dialog boxes.
const msiUILevelEndDialog = 128 'If combined with any above value, the installer displays a modal dialog box at the end of a successful installation or if there has been an error. No dialog box is displayed if the user cancels.

'=========================
'# Variables declaration #
'=========================
Dim WshShell, scriptPath, objWMI, objProcess, objFSO, strPath
Dim hostname, logFile ,debug

'=========================
'# Object initialization #
'=========================
set WshShell = CreateObject("WScript.Shell")
Set objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\.rootdefault:StdRegProv")
hostname = WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

'=============================
'# Determine script location #
'=============================
scriptPath = left(Wscript.scriptFullName, (len(Wscript.scriptFullName) - len(WScript.ScriptName)))

'=============================================================
'#Check if script is invoked by cscript engine, force if not #
'=============================================================
Const forceCscriptSilent = False
s_ForceUseCScript

'================================================================
'# Parse the commandline parameters and start the actual script #
'================================================================
parseCommandLineArguments

'=========================
'# Functions declaration #
'=========================

Sub parseCommandLineArguments ()
'====================================================================
'# Purpose : Parse the command line parameters #
'# Input : #
'====================================================================
Dim noUninstall, onlyProof, noProof, logFolder
debug = False
logFolder = WshShell.ExpandEnvironmentStrings("%SystemRoot%") & "temp\"
For Each argument In WScript.Arguments
Select Case argument
Case "-debug"
debug = True
Case Else
If StrComp(Right(argument,1), "\") <> 0 Then
logFolder = argument & "\"
End If
If Not objFSO.FolderExists( logFolder ) Then
WScript.Quit(80040005)
End If
End Select
Next

On Error Resume Next
Set logFile = objFSO.CreateTextFile(logfolder & hostname & "-" & APPNAME &"-trace.log", FORAPPENDING, True)
If Err.Number = 70 Or Err.Number = 46 Then
WScript.Echo "not running as administrator....."
logfolder = WshShell.ExpandEnvironmentStrings("%temp%") & "\"
WScript.Echo logfolder
Set logFile = objFSO.CreateTextFile(logfolder & hostname & "-" & APPNAME &"-trace.log", FORAPPENDING, True)
writeLog "LogfileError", "ERROR|Not running as administrator", "parseCommandLineArguments"
End If
On Error GoTo 0
'===================
'# Show the banner #
'===================
scriptBanner

'======================
'# Show the Help info #
'======================
showHelp

'======================================================
'# Start the main app #
'# if additional arguments are possible add them here #
'======================================================
Call runTask( )

'======================
'# Cleanup and exit #
'======================
'Close the logfile
logFile.Close
'quit with exitcode 0
WScript.quit
'quit with exitcode 3010 (For SCCM if reboot is required)
WScript.quit(3010)
End Sub

Sub showHelp()
'===============================================================================
'# Purpose : show help information on how to use the script #
'===============================================================================
wscript.echo "usage: cscript " & FILENAME & " [-debug] [-nouninstall] [-onlyproof] [logfolder]"
wscript.echo vbTab & "-debug" & vbTab & vbTab & "Show debug information"
wscript.echo vbTab & "logfolder" & vbTab & "Alterantive logfolder"
wscript.echo vbTab & "Default logfolder is c:windowstemp"
WScript.Echo ""
WScript.Echo "Possible error codes: "
If debug Then
WScript.Echo vbTab & "66600001" & vbTab & " : patchApp is called without information"
WScript.Echo vbTab & "66600002" & vbTab & " : installApp is called without information"
WScript.Echo vbTab & "66600003" & vbTab & " : killProcesses is called without information"
WScript.Echo vbTab & "66600004" & vbTab & " : uninstallApp is called without information"
End If
WScript.Echo vbTab & "80040005" & vbTab & " : Logfolder not accessible"
WScript.Echo ""
WScript.Echo "To see the returncode you start the script form a command prompt"
Wscript.Echo "and issue the command:"
WScript.Echo vbTab & "echo %errorlevel%"
End Sub

Sub runTask( )
'==============================================================================================================================
'# purpose : the actual script to run. #
'==============================================================================================================================
writeLog "start Runtask", "runTask started with the following parramenters " & _
"*debug = " & debug, "runtask"
Dim arrRemoveApps, arrKillProcesses, strDiskSize, strKeyPath, strValueName, strValue, strCMD, dwordValue

'===================================================
'# Optional: Not in use with SCCM #
'# Disckspace check for use when not in SMS / SCCM #
'===================================================
Set objLogicalDisk = objWMI.Get("Win32_LogicalDisk.DeviceID='c:'")
strDiskSize = (objLogicalDisk.FreeSpace / CONVERT_GB)
If strDiskSize < 2 Then
writeLog "checkDiskSize", "ERROR : Disksize is less than required. Why am I running???" & _
" If I am not started from SCCM this line should be changed." & _
" If run from SMS/SCCM the minimal disc requirement must be set!!!!", "runtask"
'Solve in SMS / SCCM When not in SMS / SCCM uncomment the following line
'wscript.Quit(666)
End If

'===========================================
'# Kill some Running processes if required #
'===========================================
arrKillProcesses = Array("dummy123","dummy234","dummy567")
killProcesses objWMI, arrKillProcesses

'===============================================
'# Uninstalling some obsolete applications #
'===============================================
'By application name from Add Remove Programs
arrRemoveApps = Array("Dummy123", "Dummy234", "Dummy456")
uninstallApp objWMI, arrRemoveApps

'By GUID (Product ID)
arrRemoveApps = Array("{34E9AA45-3D13-4DBD-8BC9-7F06AB39B090}", "{34666A45-3D13-4DBD-8BC9-7F0612345690}")
uninstallAppGUID objWMI, arrRemoveApps

'============================================
'# Installing the application by executable #
'============================================
writeLog "startInstall","Starting installation of Application XYZ", "runtask"
strCMD = scriptPath & "APPLICATIONSOURCEsetup.exe"
WshShell.Run strCMD, 2, True

'==========================================
'# Installing the application by msi file #
'==========================================
'With an MST file
installApp "APPLICATION-SOURCESmyapp.msi", "APPLICATIONSOURCEmyapp.mst", "LAUNCHEDBYSETUPEXE=1"
'Without an MST file
installApp "APPLICATION-SOURCESmyapp.msi", "", "LAUNCHEDBYSETUPEXE=1"
'Without properties
installApp "APPLICATION-SOURCESmyapp.msi", "APPLICATIONSOURCEmyapp.mst", ""

'==========================================
'# Patch the application With an msp file #
'==========================================
'With properties
patchApp "APPLICATIONSOURCEmyapp.msp", "MYPROPERTIE=TRUE"
'Without properties
patchApp "APPLICATIONSOURCEmyapp.msp", ""

'========================================
'# Remove legacy folder from Start Menu #
'========================================
strPath = WshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")&"Start MenuPrograms\" & "My Dummy String"
If objFSO.FolderExists (strPath) Then
writeLog "delete folder","Deleting the obsolete folder", "runtask"
objFSO.DeleteFolder(strPath)
End If


'===================================
'# Write something To the registry #
'===================================
strKeyPath = "SOFTWAREGetronicsConsulting"
strValueName = "Bas"
strValue = "Steelooper"
dwordValue = "2009"
'Write an String value
oReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
'Write an DWord value
oReg.SetDwordValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwordValue

'====================================
'# Read something from the registry #
'====================================
strKeyPath = "SOFTWAREGetronicsConsulting"
strValueName = "Bas"
strValue = ""
dwordValue = ""
'Read an String value into strValue
oReg.getStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
'Read an DWord value into dwordValue
oReg.getDwordValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwordValue

'=========================================
'# Finished processing all install tasks #
'=========================================
writeLog "Finished runTask","Finished processing the runtask sequence", "runtask"
End Sub

Private Sub uninstallApp( objWMIService, arrAppName )
'==============================================================================================================================
'# purpose : uninstall the applications which are given in the input #
'# input : objWMIService : initialised object from GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2") #
'# arrAppName : Array which contains the names of the applications to be uninstalled #
'# String which contains one name of a applications to be uninstalled #
'# #
'# Example: arrRemoveApps = Array("Office 2003 Proofing", "Microsoft Office Proof", "visio viewer") #
'# uninstallApp objWMI, arrRemoveApps #
'==============================================================================================================================
writeLog "starting uninstallApp","starting to run the sub uninstallApp", "uninstallApp"
Dim colSoftware, objSoftware, strQuery, first, strAppName
strQuery = "Select * from Win32_Product Where "
first = True
on error resume next
If IsArray( arrAppName ) Then
For Each strAppName In arrAppName
If Not first Then
strQuery = strQuery & "OR "
End If
strQuery = strQuery & "Name Like '%"& strAppName &"%' "
first = false
Next
Else
If arrAppName = "" Then
writeLog "ERROR UNINSTALL","Error uninstalling because no parameter was set. exiting with errorcode 66600004", "uninstallApp"
WScript.Quit (66600004)
End if
strQuery = strQuery & "Name Like '%"& arrAppName &"%' "
End If
Set colSoftware = objWMIService.ExecQuery (strQuery)
For Each objSoftware in colSoftware
writeLog "uninstalling","Now uninstalling " & objSoftware.Name, "uninstallApp"
objSoftware.Uninstall()
Next
on error goto 0
End Sub

Private Sub uninstallAppGUID( objWMIService, arrAppName )
'==============================================================================================================================
'# purpose : uninstall the applications which are given in the input #
'# input : objWMIService : initialised object from GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2") #
'# arrAppName : Array which contains the names of the applications to be uninstalled #
'# String which contains one name of a applications to be uninstalled #
'# #
'# Example: arrRemoveApps = Array("{34E9AA45-3D13-4DBD-8BC9-7F06AB39B090}", "{34666A45-3D13-4DBD-8BC9-7F0612345690}") #
'# uninstallAppGUID objWMI, arrRemoveApps #
'==============================================================================================================================
writeLog "starting uninstallApp","starting to run the sub uninstallApp", "uninstallApp"
Dim colSoftware, objSoftware, strQuery, first, strAppName
strQuery = "Select * from Win32_Product Where "
first = True

If IsArray( arrAppName ) Then
For Each strAppName In arrAppName
If Not first Then
strQuery = strQuery & "OR "
End If
strQuery = strQuery & "IdentifyingNumber = '%"& strAppName &"%' "
first = false
Next
Else
If arrAppName = "" Then
writeLog "ERROR UNINSTALL","Error uninstalling because no parameter was set. exiting with errorcode 66600004", "uninstallApp"
WScript.Quit (66600004)
End if
strQuery = strQuery & "IdentifyingNumber = '%"& arrAppName &"%' "
End If
Set colSoftware = objWMIService.ExecQuery (strQuery)
on error resume next
For Each objSoftware in colSoftware
writeLog "uninstalling","Now uninstalling " & objSoftware.Name, "uninstallApp"
objSoftware.Uninstall()
Next
on error goto 0
End Sub

Private Sub killProcesses ( objWMIService, arrKillProc )
'==============================================================================================================================
'# purpose : kill the processes which are passed to the function #
'# input : objWMIService : initialised object from GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2") #
'# arrKillProc : Array which contains the names of the processes to be terminated #
'# String which contains one name of a process to be terminated #
'# #
'# Example: arrKillProcesses = Array("outlook", "communicator", "winword", "excel", "powerpnt", "access") #
'# killProcesses objWMI, arrKillProcesses #
'==============================================================================================================================
writeLog "starting killProcesses", "Starting killProcesses", "killProcesses"

Dim colSoftware, objSoftware, strQuery, first, procName
strQuery = "Select * from Win32_Process where "
first = True

If IsArray( arrKillProc ) Then
For Each procName In arrKillProc
If Not first Then
strQuery = strQuery & "OR "
End If
strQuery = strQuery & "Name Like '%"& procName &"%' "
first = false
Next
Else
If arrKillProc = "" Then
writeLog "ERROR killProcesses", "ERROR - Started killProcesses with no Process te kill " & _
"- Terminiting script now with errorcode 66600003", "killProcesses"
WScript.Quit (66600003)
Else
strQuery = strQuery & "Name Like '%"& procName &"%' "
End if
End If

Set colProcess = objWMIService.ExecQuery (strQuery)
For Each objProcess in colProcess
writeLog "running killProcesses", "Killing process : " & objProcess.name, "killProcesses"
objProcess.Terminate()
Next
End Sub

Private Sub installApp( strMSI, strMST, properties )
'==========================================================================================================================
'# purpose : Install an application by directly using the Windows Installer API instead of using msiexec #
'# input : strMSI : path to the msi file to install located in a subfolder of this scriptfile #
'# strMST : path to the mst file used transform the install located in a subfolder of this scriptfile #
'# properties : String containing additional properties to pass on to the installation #
'# Standard the following are added ALLUSERS=TRUE REBOOT=REALLYSUPPRESS #
'# ALLUSERS=TRUE > if the application is scripted per user. this will install for all users #
'# REBOOT=REALLYSUPPRESS > Make sure that the installation will not reboot the machine #
'# #
'# Example: installApp "ProofingExtraPROOF_DEProof.msi", "ProofingExtraPROOF_DEProof.mst", "LAUNCHEDBYSETUPEXE=1" #
'==========================================================================================================================
writeLog "starting installApp","starting to run the sub installApp", "installApp"
If IsEmpty(strMSI) Or strMSI = "" Then
writeLog "ERROR INSTALL","Error installing because no msi parameter was set. exiting with errorcode 66600002", "installApp"
WScript.Quit(66600002)
End if
Dim objInstaller
set objInstaller = createobject("WindowsInstaller.Installer")
objInstaller.uilevel = msiUILevelNone
If strMST <> "" then
writeLog "Start installation","starting the installation of MSI File: '" & strMSI & "' with Transform file : '" & strMST & "'", "installApp"
writeLog "Start installation","Applying the properties: 'ALLUSERS=TRUE REBOOT=REALLYSUPPRESS " & strMST & "'", "installApp"
objInstaller.InstallProduct scriptPath & strMSI, "TRANSFORMS=" & scriptPath & strMST & " ALLUSERS=TRUE REBOOT=REALLYSUPPRESS " & properties
Else
writeLog "Start installation","starting the installation of MSI File: " & strMSI, "installApp"
writeLog "Start installation","Applying the properties: 'ALLUSERS=TRUE REBOOT=REALLYSUPPRESS " & strMST & "'", "installApp"
objInstaller.InstallProduct scriptPath & strMSI, "ALLUSERS=TRUE REBOOT=REALLYSUPPRESS " & properties
End If
writeLog "Finished installation","Finished the installation of MSI : '" & strMSI & "'", "installApp"
End Sub

Private Sub patchApp( strMSP, properties )
'====================================================================================================================
'# purpose : Patch an application by directlu using the Windows Installer API instead of using msiexec #
'# input : strMSP : path to the msp file to install located in a subfolder of this scriptfile #
'# properties : String containing additional properties to pass on to the installation #
'# Standard the following are added REBOOT=REALLYSUPPRESS #
'# REBOOT=REALLYSUPPRESS > Make sure that the installation will not reboot the machine #
'# #
'# Example : patchApp "ProofingExtraSP2proofsp2-de-de.msp", "" #
'====================================================================================================================
writeLog "starting patchApp","starting to run the sub patchApp", "patchApp"
If IsEmpty(strMSP) Or strMSP = "" Then
writeLog "ERROR PATCHING","Error patching because no msp parameter was set. exiting with errorcode 66600001", "patchApp"
WScript.Quit(66600001)
End If
Dim objInstaller
Set objInstaller = createobject("WindowsInstaller.Installer")
objInstaller.uilevel = msiUILevelNone
writeLog "Start installation","starting the installation of MSP File: " & strMSP, "patchApp"
writeLog "Start installation","Applying the properties: 'REBOOT=REALLYSUPPRESS " & strMST & "'", "patchApp"
objInstaller.ApplyPatch scriptPath & strMSP, "", 0, " REBOOT=REALLYSUPPRESS " & properties
writeLog "Finished installation","Finished the installation of MSP : '" & strMSP & "'", "patchApp"
End Sub

Sub s_Error(i,s)
'========================================================================
'# Purpose : Show errors generated by engine and abort script operation #
'# Input : i : err.number (integer) #
'# s : err.description (string) #
'========================================================================

wscript.echo "ERROR!"
wscript.echo "The error code was : " & i
wscript.echo "The error code in hex : " & Hex(i)
wscript.echo "The error description : " & s
wscript.quit

End Sub

Sub writeLog(strEvent, strDescription, strLocation )
'====================================================================
'# Purpose : Write logging to a file. #
'# Input : strEvent : The event to log to file #
'# strDescription : The description to log to file #
'# strLocation : the location where the logging came from #
'====================================================================
Dim strDate, strTime
strDate = parsedigits(DAY(date()),2) & "-" & _
parsedigits(MONTH(date()),2) & "-" & _
parsedigits(YEAR(date()),2)
strTime = parsedigits(Hour(Now),2) & ":" & _
parsedigits(minute(Now),2) & ":" & _
parsedigits(Second(Now),2)
logFile.WriteLine(strTime & "|" & strDate & "|" & strLocation & "|" & strEvent & "|" & strDescription)
if debug then wscript.echo(strTime & "|" & strDate & "|" & strLocation & "|" & strEvent & "|" & strDescription)
End Sub

Sub scriptBanner()
'====================================================================
'# Purpose : show the banner and copyright of the script #
'# Input : #
'====================================================================
wscript.echo APPNAME & " - " & APPDESCRIPTION & "."
wscript.echo "Copyright (c) " & COPYYEAR & " - " & COMPANYNAME & " - " & AUTHOR
wscript.echo ""
writeLog "APPNAME", APPNAME & " - " & APPDESCRIPTION & ".", "scriptBanner"
writeLog "APPNAME", "Copyright (c) " & COPYYEAR & " - " & COMPANYNAME & " - " & AUTHOR, "scriptBanner"
writeLog "", "", ""
End Sub

Function parsedigits(valuetoparse, totalDigits)
'====================================================================
'# Purpose : Return a value which is the number of digits required #
'# Input : valuetoparse : The values which must be parsed #
'# totalDigits : The number of digits required to fill #
'# #
'# example : parsedigits(2,2) returns 02 #
'# parsedigits(2,1) returns 2 #
'# parsedigits(2,3) returns 002 #
'====================================================================
if totalDigits > len(valuetoparse) then
parsedigits = String(totalDigits-len(valuetoparse),"0") & valuetoparse
else
parsedigits = valuetoparse
end if
End Function

Sub s_ForceUseCScript()
'********************************************
' Purpose: Force script to use cscript engine
'********************************************
dim strScriptEngine, exitcode
strScriptEngine = Right(WScript.FullName,len(WScript.FullName) - instrrev(WScript.FullName,"\"))
If Not LCase(strScriptEngine) = "cscript.exe" And Not LCase(strScriptEngine) = "primalhost.dll" Then
If Not forceCscriptSilent Then
WshShell.Popup "Script is not invoked uder cscript engine. Relaunching under cscript...",5,"WSCRIPT"
End If
dim strArguments
strArguments = ""
For Each arg In WScript.Arguments
If arg & "\" <> scriptPath Then strArguments = strArguments & " " & arg
Next
exitcode = WshShell.Run( "cmd.exe /C " & WshShell.ExpandEnvironmentStrings("%SystemRoot%") & "system32cscript.exe //NOLOGO " & Chr(34) & WScript.scriptFullName & Chr(34) & strArguments, 0, True)
WScript.Quit(exitcode)
End If

End Sub

'GENERIC INFORMATION

'REGISTRY
'Initialise registry
' sComputer = "." '(Localhost)
' Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
' sComputer & "/root/default:StdRegProv")

'Functions for registry editing
' GetBinaryValue - reads regisry value of BINARY type
' GetDWORDValue - reads registry value of DWORD type
' GetExpandedStringValue - reads registry value of EXPANDED STRING type
' GetMultiStringValue - reads registry value of MULTI STRING type
' GetStringValue - reads registry value of STRING type
' CreateKey - creates registry key
' SetBinaryValue - writes registry value of BINARY type
' SetDWORDValue - writes registry value of DWORD type
' SetExpandedStringValue - writes registry value of EXPANDED STRING type
' SetMultiStringValue - writes registry value of MULTI STRING type
' SetStringValue - writes registry value of STRING type
' DeleteKey - deletes registry key
' DeleteValue - deleting registry value
' EnumKey - enumerates registry key
' EnumValues - enumerates registry value
' CheckAccess - checks permissions on registry key

'WINDOWS INSTALLER
'initialisatie Windows Installer
' Set objInstaller = createobject("WindowsInstaller.Installer")

'Functions for Windows Installer Object
' AddSource - Adds a source to the list of valid network sources in the sourcelist.
' AdvertiseProduct - Advertises an installation package.
' AdvertiseScript - Advertises an installation package.
' ApplyPatch - Invokes an installation and sets the PATCH property to the path of the patch package for each product listed by the patch package as eligible to receive the patch.
' ApplyMultiplePatches - Applies one or more patches to products eligible to receive the patch. Sets the PATCH property to the path of the patch packages provided.
' ClearSourceList - Removes all network sources from the sourcelist.
' CollectUserInfo - Invokes a user interface wizard sequence that collects and stores both user information and the product code.
' ConfigureFeature - Configures the installed state of a product feature.
' ConfigureProduct - Installs or uninstalls a product.
' CreateAdvertiseScript - Generates an advertise script.
' CreateRecord - Returns a new Record object with the requested number of fields.
' EnableLog - Enables logging of the selected message type for all subsequent installation sessions in the current process space.
' ExtractPatchXMLData - Extracts information from a patch as an XML string.
' FileHash - Takes the path to a file and returns a 128-bit hash of that file.
' FileSignatureInfo - Takes the path to a file and returns a SAFEARRAY of bytes that represents the hash or the encoded certificate.
' FileSize - Returns the size of the specified file.
' FileVersion - Returns the version string or language string of the specified path.
' ForceSourceListResolution - Forces the installer to search the source list for a valid product source the next time a source is required.
' InstallProduct - Opens an installer package and initializes an installation session.
' LastErrorRecord - Returns a Record object that contains error parameters for the most recent error from the function that produced the error record.
' OpenDatabase - Opens an existing database or creates a new one.
' OpenPackage - Opens an installer package for use with functions that access the product database and install engine.
' OpenProduct - Opens an installer package for an installed product using the product code.
' ProvideAssembly - Returns the installed path of an assembly.
' ProvideComponent - Returns the full component path and performs any necessary installation.
' ProvideQualifiedComponent - Returns the full component path and performs any necessary installation.
' RegistryValue - Reads information about a specified registry key of value.
' ReinstallFeature - Reinstalls features or corrects problems with installed features.
' ReinstallProduct - Reinstalls a product or corrects installation problems in an installed product.
' RemovePatches - Removes one or more patches to products eligible to receive the patch.
' UseFeature - Increments the usage count for a particular feature and returns the installation state for that feature.

'Properties for Windows Installer Object
' ClientsEx - Read-only - Returns a RecordList object that lists products that use a specified installed component.
' Windows Installer 4.5 and earlier: Not supported.
' ComponentClients - Read-only - Returns a StringList object enumerating the set of clients of a specified component.
' ComponentPath - Read-only - Returns the full path to an installed component.
' ComponentPathEx - Read-only - Returns a RecordList object that gives the full path of a specified installed component.
' Windows Installer 4.5 and earlier: Not supported.
' ComponentQualifiers - Read-only - Returns a StringList object enumerating the set of registered qualifiers for the specified component.
' Components - Read-only - Returns a StringList object enumerating the set of installed components for all products.
' ComponentsEx - Read-only - Returns a RecordList object that lists installed components.
' Windows Installer 4.5 and earlier: Not supported.
' Environment - Read-only - The string value for an environment variable of the current process.
' FeatureParent - Read-only - Specifies the parent feature of a feature.
' Features - Read-only - Returns a StringList object enumerating the set of published features for the specified product.
' FeatureState - Read-only - Returns the installed state of a feature.
' FeatureUsageCount - Read-only - Returns the number of times that the feature has been used.
' FeatureUsageDate - Read-only - Returns the date that the specified feature was last used.
' FileAttributes - Read-only - Returns a number that represents the combined file attributes for the designated path to a file or folder.
' Patches - Read-only - Returns a StringList object that contains all the patches applied to the product.
' PatchesEx - Read-only - Enumerates a collection of Patch objects.
' PatchFiles - Read-only - Returns a StringList object that contains a list of files that can be updated by the provided list of patches.
' PatchInfo - Read-only - Returns information about a patch.
' PatchTransforms - Read-only - Returns the semicolon delimited list of transforms that are in the specified patch package and applied to the specified product.
' ProductElevated - Read-only - Returns True if the product is managed or False if the product is not managed.
' ProductInfo - Read-only - Returns the value of the specified attribute for an installed or published product.
' ProductInfoFromScript - Read-only - Returns the value of the specified attribute that is stored in an advertise script.
' Products - Read-only - Returns a StringList object enumerating the set of all products installed or advertised for the current user and machine.
' ProductsEx - Read-only - Enumerates a collection of Product objects.
' ProductState - Read-only - Returns the install state information for a product.
' QualifierDescription - Read-only - Returns a text string that describes the qualified component.
' RelatedProducts - Read-only - Returns a StringList object enumerating the set of all products installed or advertised for the current user and machine with a specified UpgradeCode property in their property table.
' ShortcutTarget - Read-only - Examines a shortcut and returns its product, feature name and component if available.
' SummaryInformation - Read-only - Returns a SummaryInfo object that can be used to examine, update and add properties to the summary information stream of a package or transform.
' UILevel - Read-Write - Indicates the type of user interface to be used when opening and processing subsequent packages within the current process space.
' Version - Read-only - Returns the string representation of the current version of Windows Installer



Use it freely if you want. But please post here if you do.

Trust my own domain in Windows XP and IE 7 (2009-09-08T17:10:00.002+02:00)

Author: Bas Steelooper

With the introduction of Internet Explorer 7 we found that some script in GPO's and programs
on shares failed to run. This because a File Security Warning was shown.

Because we don't want to restrict users from adding sites to the Trusted Zone it was not an
option to do this with the internet explorer option in the GPO. For this purpose this script
is created to perform just this task.


'==========================================================================
'
' NAME: Add the current AD Domain to local intranet zone for Windows XP and Internet Explorer 7
'
' AUTHOR: Bas Steelooper , Steelooper Consulting
' DATE : 8-12-2008
'
' COMMENT: With the introduction of Internet Explorer 7 we found that some script in GPO's and programs
' on shares failed to run. This because a File Security Warning was shown.
'
' Because we don't want to restrict users from adding sites to the Trusted Zone it was not an
' option to do this with the internet explorer option in the GPO. For this purpose this script
' is created to perform just this task.
'
'==========================================================================


On Error Resume Next

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_USERS = &H80000003

strComputer = "."
Set objReg = GetObject("winmgmts:" & "{impersonationLevel=impersonate}\" & strComputer & "rootdefault:StdRegProv")

strKeyPath = ".DEFAULTSoftwareMicrosoftWindowsCurrentVersionInternet Settings\" & "ZoneMapDomainssteelooper.com*.blog"
objReg.CreateKey HKEY_USERS,strKeyPath
strValueName = "*"
dwValue = 1
objReg.SetDWORDValue HKEY_USERS,strKeyPath,strValueName,dwValue

strKeyPath = ".DEFAULTSoftwareMicrosoftWindowsCurrentVersionInternet Settings\" & "ZoneMapDomainssteelooper.comblog"
objReg.CreateKey HKEY_USERS,strKeyPath
strValueName = "*"
dwValue = 1
objReg.SetDWORDValue HKEY_USERS,strKeyPath,strValueName,dwValue

strKeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet Settings\" & "ZoneMapDomainssteelooper.com*.blog"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "*"
dwValue = 1
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

strKeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet Settings\" & "ZoneMapDomainssteelooper.comblog"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "*"
dwValue = 1
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue



Use it freely if you want. But please post here if you do.

Manage local admins through Active Directory (2009-09-08T17:01:00.002+02:00)

Author: Bas Steelooper

For a Client we needed a way to grant a user local admin rights to his / her PC/laptop. We could use Group Policy but than we need an GPO per computer, we could use AD Groups, but than we need an AD Group for each computer and maintain that.

For this I came up with the idea to use the Managed By field of a computer object in AD. You enter a username in that field and assign the following script to run at startup through GPO.

Problem solved.....


'==========================================================================
'
' NAME: Managed By to Local Admin
'
' AUTHOR: Bas Steelooper , Steelooper Consulting
' DATE : 18-11-2008
'
' COMMENT: Add the managed by user to the local administrators.
'
'==========================================================================

On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2

dim hostname
dim objGroup

Set wshshell = CreateObject("WScript.Shell")
Set ObjEnv = WshShell.Environment("Process")
hostname = ObjEnv("COMPUTERNAME")

Set objGroup = GetObject("WinNT://./Administrators,group")

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"

Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, ManagedBy from " & _
"'LDAP://DC=code1,DC=emi,DC=philips,DC=com' where objectClass='computer' and name='" & hostname & "'"
objCommand.Properties("Page Size") = 10
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst


Do Until objRecordSet.EOF

Set objUser = GetObject( "LDAP://" & objRecordSet.Fields("ManagedBy") )

username = objUser.sAMAccountName
objGroup.add("WinNT://Code1/"&username&",user")

Set objGroup = Nothing
objRecordSet.MoveNext
Loop


Use it freely if you want. But please post here if you do.

Installer template (2009-09-08T16:54:00.005+02:00)

Author: Bas Steelooper

Since there are a lot of different way to do things I made a template for all installations. This script is rather long and contains a lot of comments. But with this script I hope that all my Install scripts will be similar and easily maintainable.

Use it freely if you want. But please post here if you do.


'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2009
'
' NAME: Installer script template
' AUTHOR: Bas Steelooper , Steelooper Consulting
' DATE : 10-09-2009
'
' COMMENT: This is the installer script template
' Create a foler to hold the install sources and this script
' Following folder structure:
'
' APPLICATION-XYZ
' |------ INSTALLATION-SOURCES
' | |--- ..........
' |
' ------ install_Template.vbs
'
' Modify the following functions to your needs
' parseCommandLineArguments
' If additional commandline options are required
' showHelp
' If additional commandline options are possible describe them here
' runTask
' The installtion tasks
'
' Start from SMS/SCCM with commandline "cscript install_Template.vbs [-debug] [logfolder]"
'
'==========================================================================

'=========================
'# Constants declaration #
'=========================
Const FILENAME = "install_Template.vbs"
Const APPNAME = "Tempalte-Installer"
Const APPDESCRIPTION = "This is the installer script template"
Const APPVER = "1.0"
Const COPYYEAR = "2009"
Const AUTHOR = "Bas Steelooper"
Const COMPANYNAME = "Steelooper Consulting"

'constants for registry editing
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_PERFORMANCE_DATA = &H80000004
Const HKEY_CURRENT_CONFIG= &H80000005
Const HKEY_DYN_DATA = &H80000006

'constants for textfiles
Const FORREADING = 1
Const FORWRITING = 2
Const FORAPPENDING = 8

'constants for eventlog
Const SUCCESS = 0
Const ERRORL = 1
Const WARNING = 2
Const INFORMATION = 4

'constants for disk access
Const HARD_DISK = 3
Const CONVERT_GB = 1073741824

'Constants for MSI
const msiUILevelNoChange = 0 'Does not change UI level.
const msiUILevelDefault = 1 'Uses default UI level.
const msiUILevelNone = 2 'Silent installation.
const msiUILevelBasic = 3 'Simple progress and error handling.
const msiUILevelReduced = 4 'Authored UI and wizard dialog boxes suppressed.
const msiUILevelFull = 5 'Authored UI with wizards, progress, and errors.
const msiUILevelHideCancel = 32 'If combined with the msiUILevelBasic value, the installer shows progress dialog boxes but does not display a Cancel button on the dialog box to prevent users from canceling the installation.
const msiUILevelProgressOnly = 64 'If combined with the msiUILevelBasic value, the installer displays progress dialog boxes but does not display any modal dialog boxes or error dialog boxes.
const msiUILevelEndDialog = 128 'If combined with any above value, the installer displays a modal dialog box at the end of a successful installation or if there has been an error. No dialog box is displayed if the user cancels.

'=========================
'# Variables declaration #
'=========================
Dim WshShell, scriptPath, objWMI, objProcess, objFSO, strPath
Dim hostname, logFile ,debug

'=========================
'# Object initialization #
'=========================
set WshShell = CreateObject("WScript.Shell")
Set objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\.rootdefault:StdRegProv")
hostname = WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

'=============================
'# Determine script location #
'=============================
scriptPath = left(Wscript.scriptFullName, (len(Wscript.scriptFullName) - len(WScript.ScriptName)))

'=============================================================
'#Check if script is invoked by cscript engine, force if not #
'=============================================================
s_ForceUseCScript

'================================================================
'# Parse the commandline parameters and start the actual script #
'================================================================
parseCommandLineArguments

'=========================
'# Functions declaration #
'=========================

Sub parseCommandLineArguments ()
'====================================================================
'# Purpose : Parse the command line parameters #
'# Input : #
'====================================================================
Dim noUninstall, onlyProof, noProof, logFolder
debug = False
logFolder = WshShell.ExpandEnvironmentStrings("%SystemRoot%") & "temp\"
For Each argument In WScript.Arguments
Select Case argument
Case "-debug"
debug = True
Case Else
If StrComp(Right(argument,1), "\") <> 0 Then
logFolder = argument & "\"
End If
If Not objFSO.FolderExists( logFolder ) Then
WScript.Quit(80040005)
End If
End Select
Next

On Error Resume Next
Set logFile = objFSO.CreateTextFile(logfolder & hostname & "-" & APPNAME &"-trace.log", FORAPPENDING, True)
If Err.Number = 70 Or Err.Number = 46 Then
WScript.Echo "not running as administrator....."
logfolder = WshShell.ExpandEnvironmentStrings("%temp%") & "\"
WScript.Echo logfolder
Set logFile = objFSO.CreateTextFile(logfolder & hostname & "-" & APPNAME &"-trace.log", FORAPPENDING, True)
writeLog "LogfileError", "ERROR|Not running as administrator", "parseCommandLineArguments"
End If
On Error GoTo 0
'===================
'# Show the banner #
'===================
scriptBanner

'======================
'# Show the Help info #
'======================
showHelp

'======================================================
'# Start the main app #
'# if additional arguments are possible add them here #
'======================================================
Call runTask( )

'======================
'# Cleanup and exit #
'======================
'Close the logfile
logFile.Close
'quit with exitcode 0
WScript.quit
'quit with exitcode 3010 (For SCCM if reboot is required)
WScript.quit(3010)
End Sub

Sub showHelp()
'===============================================================================
'# Purpose : show help information on how to use the script #
'===============================================================================
wscript.echo "usage: cscript " & FILENAME & " [-debug] [-nouninstall] [-onlyproof] [logfolder]"
wscript.echo vbTab & "-debug" & vbTab & vbTab & "Show debug information"
wscript.echo vbTab & "logfolder" & vbTab & "Alterantive logfolder"
wscript.echo vbTab & "Default logfolder is c:windowstemp"
WScript.Echo ""
WScript.Echo "Possible error codes: "
If debug Then
WScript.Echo vbTab & "66600001" & vbTab & " : patchApp is called without information"
WScript.Echo vbTab & "66600002" & vbTab & " : installApp is called without information"
WScript.Echo vbTab & "66600003" & vbTab & " : killProcesses is called without information"
WScript.Echo vbTab & "66600004" & vbTab & " : uninstallApp is called without information"
End If
WScript.Echo vbTab & "80040005" & vbTab & " : Logfolder not accessible"
WScript.Echo ""
WScript.Echo "To see the returncode you start the script form a command prompt"
Wscript.Echo "and issue the command:"
WScript.Echo vbTab & "echo %errorlevel%"
End Sub

Sub runTask( )
'==============================================================================================================================
'# purpose : the actual script to run. #
'==============================================================================================================================
writeLog "start Runtask", "runTask started with the following parramenters " & _
"*debug = " & debug, "runtask"
Dim arrRemoveApps, arrKillProcesses, strDiskSize, strKeyPath, strValueName, strValue, strCMD, dwordValue

'===================================================
'# Optional: Not in use with SCCM #
'# Disckspace check for use when not in SMS / SCCM #
'===================================================
Set objLogicalDisk = objWMI.Get("Win32_LogicalDisk.DeviceID='c:'")
strDiskSize = (objLogicalDisk.FreeSpace / CONVERT_GB)
If strDiskSize < 2 Then
writeLog "checkDiskSize", "ERROR : Disksize is less than required. Why am I running???" & _
" If I am not started from SCCM this line should be changed." & _
" If run from SMS/SCCM the minimal disc requirement must be set!!!!", "runtask"
'Solve in SMS / SCCM When not in SMS / SCCM uncomment the following line
'wscript.Quit(666)
End If

'===========================================
'# Kill some Running processes if required #
'===========================================
arrKillProcesses = Array("dummy123","dummy234","dummy567")
killProcesses objWMI, arrKillProcesses

'===============================================
'# Uninstalling some obsolete applications #
'===============================================
arrRemoveApps = Array("Dummy123", "Dummy234", "Dummy456")
uninstallApp objWMI, arrRemoveApps

'============================================
'# Installing the application by executable #
'============================================
writeLog "startInstall","Starting installation of Application XYZ", "runtask"
strCMD = scriptPath & "APPLICATIONSOURCEsetup.exe"
WshShell.Run strCMD, 2, True

'==========================================
'# Installing the application by msi file #
'==========================================
'With an MST file
installApp "APPLICATION-SOURCESmyapp.msi", "APPLICATIONSOURCEmyapp.mst", "LAUNCHEDBYSETUPEXE=1"
'Without an MST file
installApp "APPLICATION-SOURCESmyapp.msi", "", "LAUNCHEDBYSETUPEXE=1"
'Without properties
installApp "APPLICATION-SOURCESmyapp.msi", "APPLICATIONSOURCEmyapp.mst", ""

'==========================================
'# Patch the application With an msp file #
'==========================================
'With properties
patchApp "APPLICATIONSOURCEmyapp.msp", "MYPROPERTIE=TRUE"
'Without properties
patchApp "APPLICATIONSOURCEmyapp.msp", ""

'========================================
'# Remove legacy folder from Start Menu #
'========================================
strPath = WshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")&"Start MenuPrograms\" & "My Dummy String"
If objFSO.FolderExists (strPath) Then
writeLog "delete folder","Deleting the obsolete folder", "runtask"
objFSO.DeleteFolder(strPath)
End If


'===================================
'# Write something To the registry #
'===================================
strKeyPath = "SOFTWAREGetronicsConsulting"
strValueName = "Bas"
strValue = "Steelooper"
dwordValue = "2009"
'Write an String value
oReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
'Write an DWord value
oReg.SetDwordValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwordValue

'====================================
'# Read something from the registry #
'====================================
strKeyPath = "SOFTWAREGetronicsConsulting"
strValueName = "Bas"
strValue = ""
dwordValue = ""
'Read an String value into strValue
oReg.getStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
'Read an DWord value into dwordValue
oReg.getDwordValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwordValue

'=========================================
'# Finished processing all install tasks #
'=========================================
writeLog "Finished runTask","Finished processing the runtask sequence", "runtask"
End Sub

Private Sub uninstallApp( objWMIService, arrAppName )
'==============================================================================================================================
'# purpose : uninstall the applications which are given in the input #
'# input : objWMIService : initialised object from GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2") #
'# arrAppName : Array which contains the names of the applications to be uninstalled #
'# String which contains one name of a applications to be uninstalled #
'# #
'# Example: arrRemoveApps = Array("Office 2003 Proofing", "Microsoft Office Proof", "visio viewer") #
'# uninstallApp objWMI, arrRemoveApps #
'==============================================================================================================================
writeLog "starting uninstallApp","starting to run the sub uninstallApp", "uninstallApp"
Dim colSoftware, objSoftware, strQuery, first, strAppName
strQuery = "Select * from Win32_Product Where "
first = True

If IsArray( arrAppName ) Then
For Each strAppName In arrAppName
If Not first Then
strQuery = strQuery & "OR "
End If
strQuery = strQuery & "Name Like '%"& strAppName &"%' "
first = false
Next
Else
If arrAppName = "" Then
writeLog "ERROR UNINSTALL","Error uninstalling because no parameter was set. exiting with errorcode 66600004", "uninstallApp"
WScript.Quit (66600004)
End if
strQuery = strQuery & "Name Like '%"& arrAppName &"%' "
End If
Set colSoftware = objWMIService.ExecQuery (strQuery)
For Each objSoftware in colSoftware
writeLog "uninstalling","Now uninstalling " & objSoftware.Name, "uninstallApp"
objSoftware.Uninstall()
Next
End Sub

Private Sub killProcesses ( objWMIService, arrKillProc )
'==============================================================================================================================
'# purpose : kill the processes which are passed to the function #
'# input : objWMIService : initialised object from GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.rootcimv2") #
'# arrKillProc : Array which contains the names of the processes to be terminated #
'# String which contains one name of a process to be terminated #
'# #
'# Example: arrKillProcesses = Array("outlook", "communicator", "winword", "excel", "powerpnt", "access") #
'# killProcesses objWMI, arrKillProcesses #
'==============================================================================================================================
writeLog "starting killProcesses", "Starting killProcesses", "killProcesses"

Dim colSoftware, objSoftware, strQuery, first, procName
strQuery = "Select * from Win32_Process where "
first = True

If IsArray( arrKillProc ) Then
For Each procName In arrKillProc
If Not first Then
strQuery = strQuery & "OR "
End If
strQuery = strQuery & "Name Like '%"& procName &"%' "
first = false
Next
Else
If arrKillProc = "" Then
writeLog "ERROR killProcesses", "ERROR - Started killProcesses with no Process te kill " & _
"- Terminiting script now with errorcode 66600003", "killProcesses"
WScript.Quit (66600003)
Else
strQuery = strQuery & "Name Like '%"& procName &"%' "
End if
End If

Set colProcess = objWMIService.ExecQuery (strQuery)
For Each objProcess in colProcess
writeLog "running killProcesses", "Killing process : " & objProcess.name, "killProcesses"
objProcess.Terminate()
Next
End Sub

Private Sub installApp( strMSI, strMST, properties )
'==========================================================================================================================
'# purpose : Install an application by directly using the Windows Installer API instead of using msiexec #
'# input : strMSI : path to the msi file to install located in a subfolder of this scriptfile #
'# strMST : path to the mst file used transform the install located in a subfolder of this scriptfile #
'# properties : String containing additional properties to pass on to the installation #
'# Standard the following are added ALLUSERS=TRUE REBOOT=REALLYSUPPRESS #
'# ALLUSERS=TRUE > if the application is scripted per user. this will install for all users #
'# REBOOT=REALLYSUPPRESS > Make sure that the installation will not reboot the machine #
'# #
'# Example: installApp "ProofingExtraPROOF_DEProof.msi", "ProofingExtraPROOF_DEProof.mst", "LAUNCHEDBYSETUPEXE=1" #
'==========================================================================================================================
writeLog "starting installApp","starting to run the sub installApp", "installApp"
If IsEmpty(strMSI) Or strMSI = "" Then
writeLog "ERROR INSTALL","Error installing because no msi parameter was set. exiting with errorcode 66600002", "installApp"
WScript.Quit(66600002)
End if
Dim objInstaller
set objInstaller = createobject("WindowsInstaller.Installer")
objInstaller.uilevel = msiUILevelNone
If strMST <> "" then
writeLog "Start installation","starting the installation of MSI File: '" & strMSI & "' with Transform file : '" & strMST & "'", "installApp"
writeLog "Start installation","Applying the properties: 'ALLUSERS=TRUE REBOOT=REALLYSUPPRESS " & strMST & "'", "installApp"
objInstaller.InstallProduct scriptPath & strMSI, "TRANSFORMS=" & scriptPath & strMST & " ALLUSERS=TRUE REBOOT=REALLYSUPPRESS " & properties
Else
writeLog "Start installation","starting the installation of MSI File: " & strMSI, "installApp"
writeLog "Start installation","Applying the properties: 'ALLUSERS=TRUE REBOOT=REALLYSUPPRESS " & strMST & "'", "installApp"
objInstaller.InstallProduct scriptPath & strMSI, "ALLUSERS=TRUE REBOOT=REALLYSUPPRESS " & properties
End If
writeLog "Finished installation","Finished the installation of MSI : '" & strMSI & "'", "installApp"
End Sub

Private Sub patchApp( strMSP, properties )
'====================================================================================================================
'# purpose : Patch an application by directlu using the Windows Installer API instead of using msiexec #
'# input : strMSP : path to the msp file to install located in a subfolder of this scriptfile #
'# properties : String containing additional properties to pass on to the installation #
'# Standard the following are added REBOOT=REALLYSUPPRESS #
'# REBOOT=REALLYSUPPRESS > Make sure that the installation will not reboot the machine #
'# #
'# Example : patchApp "ProofingExtraSP2proofsp2-de-de.msp", "" #
'====================================================================================================================
writeLog "starting patchApp","starting to run the sub patchApp", "patchApp"
If IsEmpty(strMSP) Or strMSP = "" Then
writeLog "ERROR PATCHING","Error patching because no msp parameter was set. exiting with errorcode 66600001", "patchApp"
WScript.Quit(66600001)
End If
Dim objInstaller
Set objInstaller = createobject("WindowsInstaller.Installer")
objInstaller.uilevel = msiUILevelNone
writeLog "Start installation","starting the installation of MSP File: " & strMSP, "patchApp"
writeLog "Start installation","Applying the properties: 'REBOOT=REALLYSUPPRESS " & strMST & "'", "patchApp"
objInstaller.ApplyPatch scriptPath & strMSP, "", 0, " REBOOT=REALLYSUPPRESS " & properties
writeLog "Finished installation","Finished the installation of MSP : '" & strMSP & "'", "patchApp"
End Sub

Sub s_Error(i,s)
'========================================================================
'# Purpose : Show errors generated by engine and abort script operation #
'# Input : i : err.number (integer) #
'# s : err.description (string) #
'========================================================================

wscript.echo "ERROR!"
wscript.echo "The error code was : " & i
wscript.echo "The error code in hex : " & Hex(i)
wscript.echo "The error description : " & s
wscript.quit

End Sub

Sub writeLog(strEvent, strDescription, strLocation )
'====================================================================
'# Purpose : Write logging to a file. #
'# Input : strEvent : The event to log to file #
'# strDescription : The description to log to file #
'# strLocation : the location where the logging came from #
'====================================================================
Dim strDate, strTime
strDate = parsedigits(DAY(date()),2) & "-" & _
parsedigits(MONTH(date()),2) & "-" & _
parsedigits(YEAR(date()),2)
strTime = parsedigits(Hour(Now),2) & ":" & _
parsedigits(minute(Now),2) & ":" & _
parsedigits(Second(Now),2)
logFile.WriteLine(strTime & "|" & strDate & "|" & strLocation & "|" & strEvent & "|" & strDescription)
if debug then wscript.echo(strTime & "|" & strDate & "|" & strLocation & "|" & strEvent & "|" & strDescription)
End Sub

Sub scriptBanner()
'====================================================================
'# Purpose : show the banner and copyright of the script #
'# Input : #
'====================================================================
wscript.echo APPNAME & " - " & APPDESCRIPTION & "."
wscript.echo "Copyright (c) " & COPYYEAR & " - " & COMPANYNAME & " - " & AUTHOR
wscript.echo ""
writeLog "APPNAME", APPNAME & " - " & APPDESCRIPTION & ".", "scriptBanner"
writeLog "APPNAME", "Copyright (c) " & COPYYEAR & " - " & COMPANYNAME & " - " & AUTHOR, "scriptBanner"
writeLog "", "", ""
End Sub

Function parsedigits(valuetoparse, totalDigits)
'====================================================================
'# Purpose : Return a value which is the number of digits required #
'# Input : valuetoparse : The values which must be parsed #
'# totalDigits : The number of digits required to fill #
'# #
'# example : parsedigits(2,2) returns 02 #
'# parsedigits(2,1) returns 2 #
'# parsedigits(2,3) returns 002 #
'====================================================================
if totalDigits > len(valuetoparse) then
parsedigits = String(totalDigits-len(valuetoparse),"0") & valuetoparse
else
parsedigits = valuetoparse
end if
End Function

Sub s_ForceUseCScript()
'********************************************
' Purpose: Force script to use cscript engine
'********************************************
dim strScriptEngine, exitcode
strScriptEngine = Right(WScript.FullName,len(WScript.FullName) - instrrev(WScript.FullName,"\"))
If Not LCase(strScriptEngine) = "cscript.exe" And Not LCase(strScriptEngine) = "primalhost.dll" Then
WshShell.Popup "Script is not invoked uder cscript engine. Relaunching under cscript...",5,"WSCRIPT"
dim strArguments
strArguments = ""
For Each arg In WScript.Arguments
If arg & "\" <> scriptPath Then strArguments = strArguments & " " & arg
Next
exitcode = WshShell.Run( "cmd.exe /C " & WshShell.ExpandEnvironmentStrings("%SystemRoot%") & "system32cscript.exe //NOLOGO " & Chr(34) & WScript.scriptFullName & Chr(34) & strArguments,0,True)
WScript.Quit(exitcode)
End If

End Sub

'GENERIC INFORMATION

'REGISTRY
'Initialise registry
' sComputer = "." '(Localhost)
' Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
' sComputer & "/root/default:StdRegProv")

'Functions for registry editing
' GetBinaryValue - reads regisry value of BINARY type
' GetDWORDValue - reads registry value of DWORD type
' GetExpandedStringValue - reads registry value of EXPANDED STRING type
' GetMultiStringValue - reads registry value of MULTI STRING type
' GetStringValue - reads registry value of STRING type
' CreateKey - creates registry key
' SetBinaryValue - writes registry value of BINARY type
' SetDWORDValue - writes registry value of DWORD type
' SetExpandedStringValue - writes registry value of EXPANDED STRING type
' SetMultiStringValue - writes registry value of MULTI STRING type
' SetStringValue - writes registry value of STRING type
' DeleteKey - deletes registry key
' DeleteValue - deleting registry value
' EnumKey - enumerates registry key
' EnumValues - enumerates registry value
' CheckAccess - checks permissions on registry key

'WINDOWS INSTALLER
'initialisatie Windows Installer
' Set objInstaller = createobject("WindowsInstaller.Installer")

'Functions for Windows Installer Object
' AddSource - Adds a source to the list of valid network sources in the sourcelist.
' AdvertiseProduct - Advertises an installation package.
' AdvertiseScript - Advertises an installation package.
' ApplyPatch - Invokes an installation and sets the PATCH property to the path of the patch package for each product listed by the patch package as eligible to receive the patch.
' ApplyMultiplePatches - Applies one or more patches to products eligible to receive the patch. Sets the PATCH property to the path of the patch packages provided.
' ClearSourceList - Removes all network sources from the sourcelist.
' CollectUserInfo - Invokes a user interface wizard sequence that collects and stores both user information and the product code.
' ConfigureFeature - Configures the installed state of a product feature.
' ConfigureProduct - Installs or uninstalls a product.
' CreateAdvertiseScript - Generates an advertise script.
' CreateRecord - Returns a new Record object with the requested number of fields.
' EnableLog - Enables logging of the selected message type for all subsequent installation sessions in the current process space.
' ExtractPatchXMLData - Extracts information from a patch as an XML string.
' FileHash - Takes the path to a file and returns a 128-bit hash of that file.
' FileSignatureInfo - Takes the path to a file and returns a SAFEARRAY of bytes that represents the hash or the encoded certificate.
' FileSize - Returns the size of the specified file.
' FileVersion - Returns the version string or language string of the specified path.
' ForceSourceListResolution - Forces the installer to search the source list for a valid product source the next time a source is required.
' InstallProduct - Opens an installer package and initializes an installation session.
' LastErrorRecord - Returns a Record object that contains error parameters for the most recent error from the function that produced the error record.
' OpenDatabase - Opens an existing database or creates a new one.
' OpenPackage - Opens an installer package for use with functions that access the product database and install engine.
' OpenProduct - Opens an installer package for an installed product using the product code.
' ProvideAssembly - Returns the installed path of an assembly.
' ProvideComponent - Returns the full component path and performs any necessary installation.
' ProvideQualifiedComponent - Returns the full component path and performs any necessary installation.
' RegistryValue - Reads information about a specified registry key of value.
' ReinstallFeature - Reinstalls features or corrects problems with installed features.
' ReinstallProduct - Reinstalls a product or corrects installation problems in an installed product.
' RemovePatches - Removes one or more patches to products eligible to receive the patch.
' UseFeature - Increments the usage count for a particular feature and returns the installation state for that feature.

'Properties for Windows Installer Object
' ClientsEx - Read-only - Returns a RecordList object that lists products that use a specified installed component.
' Windows Installer 4.5 and earlier: Not supported.
' ComponentClients - Read-only - Returns a StringList object enumerating the set of clients of a specified component.
' ComponentPath - Read-only - Returns the full path to an installed component.
' ComponentPathEx - Read-only - Returns a RecordList object that gives the full path of a specified installed component.
' Windows Installer 4.5 and earlier: Not supported.
' ComponentQualifiers - Read-only - Returns a StringList object enumerating the set of registered qualifiers for the specified component.
' Components - Read-only - Returns a StringList object enumerating the set of installed components for all products.
' ComponentsEx - Read-only - Returns a RecordList object that lists installed components.
' Windows Installer 4.5 and earlier: Not supported.
' Environment - Read-only - The string value for an environment variable of the current process.
' FeatureParent - Read-only - Specifies the parent feature of a feature.
' Features - Read-only - Returns a StringList object enumerating the set of published features for the specified product.
' FeatureState - Read-only - Returns the installed state of a feature.
' FeatureUsageCount - Read-only - Returns the number of times that the feature has been used.
' FeatureUsageDate - Read-only - Returns the date that the specified feature was last used.
' FileAttributes - Read-only - Returns a number that represents the combined file attributes for the designated path to a file or folder.
' Patches - Read-only - Returns a StringList object that contains all the patches applied to the product.
' PatchesEx - Read-only - Enumerates a collection of Patch objects.
' PatchFiles - Read-only - Returns a StringList object that contains a list of files that can be updated by the provided list of patches.
' PatchInfo - Read-only - Returns information about a patch.
' PatchTransforms - Read-only - Returns the semicolon delimited list of transforms that are in the specified patch package and applied to the specified product.
' ProductElevated - Read-only - Returns True if the product is managed or False if the product is not managed.
' ProductInfo - Read-only - Returns the value of the specified attribute for an installed or published product.
' ProductInfoFromScript - Read-only - Returns the value of the specified attribute that is stored in an advertise script.
' Products - Read-only - Returns a StringList object enumerating the set of all products installed or advertised for the current user and machine.
' ProductsEx - Read-only - Enumerates a collection of Product objects.
' ProductState - Read-only - Returns the install state information for a product.
' QualifierDescription - Read-only - Returns a text string that describes the qualified component.
' RelatedProducts - Read-only - Returns a StringList object enumerating the set of all products installed or advertised for the current user and machine with a specified UpgradeCode property in their property table.
' ShortcutTarget - Read-only - Examines a shortcut and returns its product, feature name and component if available.
' SummaryInformation - Read-only - Returns a SummaryInfo object that can be used to examine, update and add properties to the summary information stream of a package or transform.
' UILevel - Read-Write - Indicates the type of user interface to be used when opening and processing subsequent packages within the current process space.
' Version - Read-only - Returns the string representation of the current version of Windows Installer.


Use it freely if you want. But please post here if you do.

iSAW - Update (2009-07-19T06:47:00.002+02:00)

Author: Bas Steelooper

In a previous post I pointed to the iSAW which was available for pre order. The website is now updated with the message pro-order is clossed. Check the website for the reason.
http://www.usbchainsaw.com/

KON-BOOT (2009-07-13T21:18:00.003+02:00)

Author: Bas Steelooper

Today I stumbled on a piece of hacking software: KON-BOOT by Piotr Bania
I haven' tried it yet but the information on the site is promissing:

Kon-Boot is an prototype piece of software which allows to change contents of a linux kernel (and now Windows kernel also!!!) on the fly (while booting). In the current compilation state it allows to log into a linux system as 'root' user without typing the correct password or to elevate privileges from current user to root. For Windows systems it allows to enter any password protected profile without any knowledge of the password. It was acctually started as silly project of mine, which was born from my never-ending memory problems :) Secondly it was mainly created for Ubuntu, later i have made few add-ons to cover some other linux distributions. Finally, please consider this is my first linux project so far :) Entire Kon-Boot was written in pure x86 assembly, using old grandpa-geezer TASM 4.0.
And the list of tested Windows version is scary:

Tested Windows versions

Windows Server 2008 Standard SP2 (v.275)
Windows Vista Business SP0
Windows Vista Ultimate SP1
Windows Vista Ultimate SP0
Windows Server 2003 Enterprise
Windows XP
Windows XP SP1
Windows XP SP2
Windows XP SP3
Windows 7
Check it out on http://www.piotrbania.com/all/kon-boot/
Also check out his blog: http://blog.piotrbania.com/

Enabling virtualization on a Sony Vaio (The Unofficial guide) (2009-07-13T20:40:00.009+02:00)

Author: Bas Steelooper

Since the Sony Vaio is a pretty expensive laptop, and Sony won't give full support, an Sony customer needs to be creative to unleash the full potential of his Sony Vaio.

In this case my Sony Vaio doesn't support Virtualization. This is needed to use XP mode in Windows 7. Or if you want to use Hyper-V in Windows Server 2008. My processor supports virtualization, but only the BIOS won't let me enable this :-(

Several mails to sony support al came back stating that it is not supported and won't ever be supported on my model. Sony has made choices on which models to support, and the model I have is NOT one of them...

Since I want the full package if I buy something, and cannot return the laptop, I had to be creative. I started nosing around on the internet and with help I came to the following guide:

This is my guide to enable Virtualization on a Sony Vaio.

· Download HP USB Disk Storage Format Tool (http://www.bootdisk.com/plan040109/hpflash1.zip)
· Download Virtual Floppy Driver (http://chitchat.at.infoseek.co.jp/vmware/vfd21-080206.zip)
· Download a boot floppy image (http://www.bootdisk.info/modules.php?modid=1&id=55)
· Install and start the Virtual Floppy Driver
· Initiate the floppy drive (Run as Admin)
· Install the boot floppy image on the virtual floppy drive
· Install and Start the HP USB Disk Storage Format Tool ( Run as Admin )
o Install as FAT32
o Select Quick Formateren
o Select DOS Startup disk
§ Use the files on the virtual floppy drive
o Click Start
· Copy SYMCMOS.EXE to the USB Drive (ftp://ftp.supermicro.com/utility/Phoenix_bios_utility/SYMCMOS.EXE)
· Copy pedit to the USB Drive (http://www.flaxfx.com/dwl/pedit.zip )
· Restart your Sony Vaio from the USB Disk
· Enter the following commands:
o symcmos -v2 -lcmos.sav
o peditpedit.exe cmos.sav
§ Modify the register from 0000 to 0001 on the following place (dependent of the laptop model)
§ SONY MODEL BIOS VERSION REGISTER
========== ============ ========
VGN-AR21S R0200J6 reg 0195
VGN-AR41S R0030J8 reg 027F
VGN-AR51M R1050J8 reg 027F
VGN-AR51SU R1050J8 reg 027F
VGN-AR51E reg 027F
VGN-AR61ZRU R2080J8 reg 0285
VGN-AR670 R1050J8 reg 027F
VGN-AR71M R2090J8 reg 0285
VGN-AR71S R2090J8 reg 0285
VGN-C290N R0080J4 reg 0318
VGN-CR520E R3041Q0 reg 05BB
VGN-FE890 R0200J3 reg 0195
VGN-FZ11ZR R0050J7 reg 02D3
VGN-FZ180E R0050J7 reg 02D3
VGN-FZ21M reg 02CD
VGN-FZ21Z R1120J7 reg 02CD
VGN-TZ27GN R0071N7 reg 0363
VGN-FZ280E R1120J7 reg 02CD
VGN-FZ290 reg 02CD
VGN-FZ290E R1120J7 reg 02CD
VGN-FZ31M R2110J7 reg 02D0
VGN-FZ340E R2110J7 reg 02D0
VGN-FZ470E R2110J7 reg 02D0
VGN-FZ490N R2110J7 reg 02D0
VGN-FZ91NS R1120J7 reg 02CD
VGN-SZ R0112N0 reg 0354
VGN-SZ R0101S5 reg 02F1
VGN-SZ1XP reg 0399
VGN-SZ330P R0096N0 reg 0399
VGN-SZ370 R0096N0 reg 0399
VGN-SZ3XP R0096N0 reg 0318
VGN-TX3XP R0034N3 reg 03A2
VGN-TZ130N R0052N7 reg 0363
VGN-TZ180 reg 027F
VGN-TZ1RXN_B R0061N7 reg 0363
VGN-TZ91HS R0052N7 reg 0363
§ Save your changes ( Alt-F Save )
§ Close pedit ( alt-x )
o symcmos -v2 -ucmos.sav
·Cold Reboot the systeem and virtualization should be on.

NOTE: Use at own Risks. I am not responsible for any problems which might occur from this change

Created a guide with the information from How to Enable Intel VT and AHCI on a VAIO SZ
Tested on my Sony Vaio

Edit: Updated the list
Edit: modified bootflop download link

Office 2010: The movie (2009-07-10T09:11:00.007+02:00)

Author: Bas Steelooper


See also: www.office2010themovie.com

i.Saw - The World's First USB-powered Chainsaw (2009-07-08T17:43:00.009+02:00)

Author: Bas Steelooper



I knew it is possible to bring IT to every job. Even the lumberjack is not safe for improvement:

i.Saw - The World's First USB-powered Chainsaw

Add HD Audio bus driver using txtsetup.sif (2009-07-07T10:00:00.003+02:00)

Author: Bas Steelooper

This shows how to add the HD Audio bus driver without PNP support in WinPE 2005. This is the recommended method for BDD 2007 since it doesn't require recompiling the WinPE image, and is a lot faster than using WinPE 2005 PNP support. But this also works for MDT 2008.

This example assumes that you have created an OSD deployment point and created the WinPE 2005 Generic Image by updating the Deployment Point. In the example my OSD Deployment point is on F:OSD-XP


1. Request, download and extract the 888111 hotfix to c:tmp
2. Copy the hdaudbus.sys file from c:tmpcommon files to F:OSD-XPBootSourcei386system32drivers
3. Modify the F:OSD-XPBootSourcei386txtsetup.sif file using following info
a. In the [SCSI.LOAD] section add
hdaudbus = hdaudbus.sys,4
b. In the [HardwareIdsDatabase] section, add
PCICC_0403 = "hdaudbus" ( NOTE: Make sure that the " are correct )
4. Update OSD with the new WinPE structure (F:OSD-XPBootSource)
5. Create a new Zero Touch Installation CD

Source: For John - Don't mess with my audio drivers

No more driver issues for new Dell systems (2009-07-07T08:57:00.002+02:00)

Author: Bas Steelooper

When deploying systems ever found yourself in need for a good driver set which contains all drivers, and no duplicates.
I was.
For our customer we had to create a deployment solution to deploy several Dell systems. We had some problems with the Latitudes E4300, E6400 and E6500 and the Precision M6400. The problem was that not all drivers were easily found on the internet. For instance we had problems with the Broadcom USH driver.

We were glad to find that Dell created a website with on there cabfiles with all drivers for a system.
Also they created a page with a lot of instructions and howtos, and a complete instruction how to inject the winpe driver set into winpe. Really awesome.

Single partition when refreshing a computer? (2009-07-07T08:50:00.004+02:00)

Author: Bas Steelooper

In my search for a script to copy the $OEM$ files I also found a script on the Project84 website which makes it possible to have only one partition when deploying a computer in a refresh scenario. A refresh scenario is the scenario in which you reinstall the computer and use USMT to save and restore the userstate. Normaly when this is done it is not possible to format the harddrive since you might remove all the needed files.
This script simply removes all additional partitions on the disk and then resize the System Partition.

For our customer this is used to come to a standard client and remove all legacy states with multiple partitions.. Really great script.

$OEM$ Files when using SCCM and MDT (2009-07-07T08:40:00.004+02:00)

Author: Bas Steelooper

When deploying images with MDT in combination with SMS or just MDT you can place the $oem$ files in the MDT Distribution share. With SCCM this is not possible (or at least not working)
To find a solution for this I started searching the internet (just following my motto not to create anything I someone else has already shared this.
This search brought me to the site of Project84mirror where they placed a script which did exactly what I wanted. The script simply copies the files which are placed in the MDT Settings Package $OEM$ folder (you have to create this folder)
This are the steps to perform to get this working (taken from the Project84mirror website)

  1. Added my $OEM$ Files to my MDT Settings Package. (The one with unattend.txt, sysprep.inf and customsettings.ini)
  2. Add Z-CONFIG-CopyOEM.wsf to your MDT Source Files package. I've provided it below. (Remember to update DP)
  3. In your Task Sequence right before "Setup Windows and ConfigMgr" add a new "Run Command Line" task.
  4. Set the Name to "Copy OEM Files".
  5. Set the Command Line to "cscript.exe "%deployroot%scriptsZ-CONFIG-CopyOEM.wsf".
  6. Click the "Package" checkbox and select your MDT Settings Package.
  7. All Done!

SMS / SCCM Client healthscript (2009-07-07T08:02:00.003+02:00)

Author: Bas Steelooper

For a customer we needed a solution for the SMS agents which were failing.
I stumbled upon the script from Brian Mason: SMS Client Health Script Since the use of this script the failures of clients have minimized. But then the customer decided to upgrade their SMS environment to SCCM 2007. Since I didn't know if the script was SCCM complient I started searching on the internet. There I found the blog of Shaun Cassels with an updated version of the script.
We tried that script and found a little problem during deployment. When a client is being deployed the client is reassigned to another SCCM Site server. The deployment server is a seperate server. Bummer.

Did some hobbying arround and came up with the following

Made changes are:

If WKS_ASSIGNSITECODE is not equal to AUTO have the sitecode set in the client to the requested

If the installation is still ongoing in a different site ( PXEInstallationSite ) the reassignment will not occur and the script will exit.


' =============================================================================
' Method: CHK_ASSIGNMENT
' Description: Checks Client Site Assignment
' =============================================================================
Dim PXEInstallationSite = "S01"
Sub CHK_ASSIGNMENT
On ERROR Resume Next
Err.clear
COLLECTMSG "CHK_ASSIGNMENT",">",NULL
Dim oSMSClient
Set oSMSClient = CreateObject ("Microsoft.SMS.Client")
If err.Number<>0 Then
COLLECTMSG "CHK_ASSIGNMENT","ERROR", Err.description
COLLECTMSG "CHK_ASSIGNMENT","Could not create SMS Client Object - Quitting", Null
Else
' BSt modification start
Dim mySMSSite
mySMSSite = oSMSClient.GetAssignedSite
if mySMSSite = PXEInstallationSite and objFSO.FolderExists("c:_SMSTaskSequence") then
wscript.quit
End if
' BSt modification end
If Len(mySMSSite) = 0 Then
CLIENTSTATE = CLIENTSTATE + 1
RegCounter "CHK_ASSIGNMENT",1
If WKS_ASSIGNSITECODE = "AUTO" Then
'have the client determine from AD or SLP appropraite site code
oSMSClient.ReAssignSite
COLLECTMSG "CHK_ASSIGNMENT", _
"Error - Client not installed correctly - Setting AUTO", _
Null StrERRType=StrERRType & "ASSIGNMENT_"
Else
oSMSClient.SetAssignedSite(WKS_ASSIGNSITECODE)
COLLECTMSG "CHK_ASSIGNMENT", _
"Error - Client not installed correctly - Setting " &_
WKS_ASSIGNSITECODE, Null StrERRType=StrERRType & "ASSIGNMENT_"
End If
Else
COLLECTMSG "CHK_ASSIGNMENT",">", "Assigned Site = " & _
oSMSClient.GetAssignedSite
End If
End If
Set oSMSClient=Nothing
End Sub

Zweefvliegen (2009-07-07T07:22:00.010+02:00)

Author: Bas Steelooper

Bij een project voor mijn werk was er een "Wedstrijd" uitgeschreven waarmee je een zweefvliegtocht kon winnen. Dit werd aangeboden door de Account Manager van die klant, Jan Senft.

Wonder boven wonder won ik deze zweefvliegtocht met Jan Senft. Na een aantal vergeefse pogingen om een overeenkomend gaatje te vinden in onze agenda's hadden we er eindelijk een gevonden op 27 September.

Na al mijn gegevens doorgegeven te hebben mocht ik me om 1000 uur melden voor de briefing. Aangezien het op een luchtmacht terein was, Luchtmacht basis Meerhoven in Eindhoven, was ik iets eerder. Om 930 uur melde ik me bij de bewaking en na het achterlaten van mijn rijbewijs kreeg ik een pasje waarmee ik het terrein op mocht.
Daarna een stukje doorrijden en me melden bij het clubhuis van de Eindhovense Aero Club, EAC. Daar aangekomen bood Jan me eerst een kop koffie aan om wakker te worden.

Om 1000 uur begon de briefing. In de briefing word normaal een heleboel informatie gegeven waaronder de vliegcondities, windstanden, vlieggebieden, radio frequenties etc. Echter deze keer was de briefing wat summier omdat het geen goed vliegweeer was. Het was meer "Terrasweer" volgens de vliegers.
Meteen kwam de uitleg dat zweefvliegers heel moeilijk tevreden zijn over het weer. Het weekend dat we gingen vliegen was er net een hoge druk gebied boven eindhoven. En een hoge druk gebied betekend stabiel weer. Als het weer stabiel is is er geen termiek en zonder termiek kun je niet in de lucht blijven....

Na de briefing kreeg ik een rondleiding over het terrein van de EAC. Op dit terein staat naast het clubhuis, waar de bar en briefing ruimte is, een hangar / werkruimte / garage, een zweefvliegtuig parkeerplaats ( hier staan een hele rij met vliegtuigen ) en natuurlijk het start en landings veld.

Daarna begonnen we met het uitpakken van het zweefvliegtuig. Dit was een Duo Discus Turbo. Duo omdat het een twee zitter is, Turbo omdat het uitgerust is met een hulpmotor.
Het zweefvliegtuig zit in een lange aanhanger. In de aanhanger zie je dan een romp, met daar aan weerszijden een vleugel, die los op zijn kant naast de romp staat en de staartvleugel hangt aan het plafond.



Het vliegtuig word de aanhanger uitgerold en vervolgens word alles gecontrolleerd, en vandaag werd ook alles uitgelegd.










Het instrumenten paneel werd uitgelegt. Hierop is alles eigenlijk dubbel uitgevoerd. Een keer analoog, geen stroom nodig, en een keer digitaal.

Na een volledige uitleg van het hele vliegtuig gingen we even lunchen en hulp inroepen van iemand om het vliegtuig in elkaar te zetten.

Nadat het vliegtuig in elkaar gezet was, gingen we parachutes halen, accus aansluiten en werd het vliegtuig naar de start plaats gesleept. Daar aangekomen hebben we het vliegtuig aan de kant neergezet, en werd daar een en ander uitgelegd.
Bij de startplaats word met licht signalen aan de lierman aangegeven dat er een vliegtuig klaar staat om gelanceerd te worden, of de kabel strak staat en of de verkeersleiding toestemming heeft gegeven om op te stijgen.

Als de toestemming is gegeven en een vliegtuig word gelanceerd gaat dat met een rot vaart. in notime van 0 naar 100.....
Na een aantal starts bekeken te hebben was het mijn buurt om gelanceerd te worden.

Nadat we aangekoppeld waren aan de startkabel was het wachten op goedkeuring.


Toen mochten we de lucht in.... dit is echt heel erg gaaf... Die versnelling is niet normaal.... zo snel....
En dan ben je in de lucht. Dit gaat zo snel... dat kun je niet echt bevatten.
En een paar tellen later ben je los van de kabel en 300 meter in de lucht.... Aangezien er weinig tot geen termiek was en het niet leuk is om meteen weer te moeten landen zette Jan de hulp motor aan zodat we iets konden klimmen.



Aangekomen op iets meer dan een kilometer had je een "mooi" uitzicht. Wat heel mooi te zien was is de laag smog die onder de inversie laag hing. Op deze hoogte ging de motor uit en gingen we zweven.... Dit is heel appart om mee te maken doordat het volledig stil is om je heen.... En toch ben je hoog in de lucht...








Na ongeveer 40 minuten in de lucht te zijn geweest gingen we landen.






































Nadat we veilig geland waren zijn we nog even bij de lier wezen kijken. De lier is grote vrachtwagen met daarop 4 katrollen. Op elke katrol zit ongeveer een kilometer dynema kunstof touw. Vroeger werd hiervoor staal kabel gebruikt, maar dat is tegenwoordig dus vervangen door kunststof.

Na het bekijken van een aantal start en landingen was het tijd om de meest traditionele onderdeel van het zweefvliegen te gaan meemaken.... Het naborrelen...

Al met al was het een hele gezellige dag!!!!!

Krijg je ooit de kans dan moet je het zeker proberen!!!!