Posts

Detection Method for MSU in Applications for SCCM 2012

In SCCM 2012 Applications you can have a detection method set for MSU with KB numbers. You can use the Powershell or VBScript to do this. Here is an example of both. Powershell Script: get-hotfix | Where-Object {$_.HotFixID -match "KB981603"} VBScript: 'Returns info if Windows 'KB981603'  in installed ' ----------------------------------------------------------' Option Explicit Dim objWMIService, strComputer strComputer = "." 'Run the query Set objWMIService = GetObject("winmgmts:" _     & "{impersonationLevel=impersonate}!\\" _     & strComputer & "\root\cimv2")   Dim QFEs Dim QFE Set QFEs = objWMIService.ExecQuery ("Select * from win32_QuickFixEngineering where HotFixID like 'KB981603'") For Each QFE in QFEs     Wscript.echo "Update KB981603 was installed by " & QFE.InstalledBy & " on " & QFE.InstalledOn Next WScript.Quit

VBScript to Delete Registrly key and all subkeys

This script has worked good for me and I would like to share with all. Option Explicit     Dim intHive     Dim strComputer     Dim strKeyPath, objRegistry     Const HKEY_CLASSES_ROOT        = &H80000000     Const HKEY_CURRENT_USER    = &H80000001     Const HKEY_LOCAL_MACHINE    = &H80000002     Const HKEY_USERS        = &H80000003     Const HKEY_CURRENT_CONFIG    = &H80000005     'On Error Resume Next     strComputer            = "."     intHive                = HKEY_LOCAL_MACHINE       strKeyPath            = "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ABC\XYZ"     Set objRegistry        = GetObject("winmgmts:\\" & strComputer & "\...

VBScript to Delete Folder and all SubFolders with files

Here is the VBScript which will delete all Folders and Subfolders with even have files in it. It took me so many hours to find this perfect script and all credits go to Rob van der Woude and the original script is here: http://www.robvanderwoude.com/vbstech_folders_deltree.php I just want to keep this for my reference and for everyone so that we all can save some time. Option Explicit Dim objFSO, objTempFolder, strTempFolder Const TEMP_FOLDER = 2 Set objFSO        = CreateObject( "Scripting.FileSystemObject" ) Set objTempFolder = objFSO.GetSpecialFolder( TEMP_FOLDER ) strTempFolder     = objTempFolder.Path DelTree strTempFolder, True Sub DelTree( myFolder, blnKeepRoot ) ' With this subroutine you can delete folders and their content, ' including subfolders. ' You can specify if you only want to empty the folder, and thus ' keep the folder itself, or to delete the folder itself as well. ' Root directories and some (not all)...

Permissions to registry using setacl

Recently I was trying giving permission to one of the registry hives with Subinacl, but it was not working despite all efforts and checking all the syntax and a lot of troubeshooting. Then I came across another permission granting utility known as SetACL. It worked like a charm. So you can try using this utility is Subinacl fails. You can download SetACL from  http://helgeklein.com/download/ Here is an example to run SetACL to give registry permissions. "SetACL.exe" -on "hkcr\Interface" -ot reg -actn setowner -ownr "n:Administrators" "SetACL.exe" -on "hkcr\Interface" -ot reg -actn ace -ace "n:Users;p:full" Object name (-on) : This is the path to the object SetACL should operate on (file/directory/registry key/network share/service/printer). Object type (-ot) : What kind of object does the object name refer to: file or directory (file), registry key (reg), service (srv), printer (prn), network share (shr)? Action (-actn) : What...

Install MSP file with MSI

While handling with MSP of applications, sometimes a question comes in mind that can an MSP be installed along with MSI? The answer is yes, but with a few conditions involved. The conditions are explained later in the post with some description. First I will give you the command line to install MSP along with MSI: msiexec /i {Path to MSI}\Installer.MSI PATCH={Path to MSP}\Patch.MSP /qb If there is a transform as well to add you can include it in the command line as well. msiexec /i {Path to MSI}\Installer.MSI TRANSFORMS={Path to Transform}\Transform.MST PATCH={Path to MSP}\Patch.MSP /qb The only thing which you have to take care in the command line is that you will have to give a complete path to MSP. Relative paths do not work in this case. This will apply the patch as in the updated files will be installed from the patch rather than from the MSI. This process is greatly useful when there are a lot of patches to be applied to an MSI. There might be cases that the MSI is alrea...

Error installing MSI from USB/DVD

Image
I faced an issue installing Flash player from USB drive though it was installing fine when installed from local or network drive. I found out the issue and resolution and want to document here for all of you. While installing the package, I got this error in the log files:   MSI (s) (44:C4) [14:06:35:318]: Source is incorrect. Volume label should be   but is SMSBOOT. MSI (s) (44:C4) [14:06:46:956]: Source is incorrect. Volume label should be   but is SMSBOOT.   While analysing this, I realized that the disk label for my USB is SMSBOOT and this could be anything else for you on your USB or DVD. I had added a file in my MSI through MST and it had created an entry in the Media table. This entry looked like this and this is the default entry which you get with the tool.     Behind the scene it was looking for a Blank labelled disk where this media is located but could not find it and it gave an error “Insert Disk”. I removed the label from my USB drive and kept...

Subinacl to give permissions to registry/Files

Subinacl is a useful utility to give permissions to registries. Here is a simple example how to give permissions to registry. subinacl.exe /subkeyreg HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Optika /grant=administrators=f /grant=system=f /grant=users=f /setowner=administrators >> %temp%\subinacl_output.txt /keyreg HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Optika /grant=administrators=f /grant=system=f /grant=users=f /setowner=administrators >> %temp%\subinacl_output.txt Subinacl can be downloaded from net. More detailed Usage as per your requirements. This contains lots of features. You can write your comments on what you used and if it worked. Help others by posting your real time examples. Usage :      SubInAcl [/option...] /object_type object_name [[/action[=parameter]...] /options    :     /outputlog=FileName                 /errorlog=FileName ...