Mick's IT Blogs

Mick's IT Blogs

30 March 2012

UI Script to create Bootable Thumb Drives using WIM Files

Posted By: Mick Pletcher - 3:07 PM

I wrote this script to automate the process of creating bootable thumb drives from WIM files. In order for this script to work, WinPE must be installed on the machine and its location specified in the VBScript variable WinPELoc. On my own machine, I used the directory c:\winpe, which is also where you will place the WIM files that will be pushed down to the thumb drive. 


NOTE: In the variable CopyFiles, under the CopyOS procedure, you will see the very end of that line says f:\ before the closing quotation mark. That is the next free drive letter on my machine that windows automatically assigns to the thumb drive when it is plugged back in. It will vary on machines depending on the drive configurations. 



Here is a link to download the VBScript


 '*******************************************************************************  
 '     Program: CreateUSB.vbs  
 '      Author: Mick Pletcher  
 '        Date: 08 February 2010  
 '    Modified:  
 '  
 ' Description: This script creates a bootable USB thumb drive from a WIM file.  
 '              WinPE must be installed on the machine and its directory  
 '              specified in constant WinPELoc with no backslash after it. The  
 '              WIM files reside in the WinPELoc directory for which this script  
 '              reads from. A diskpart script must also be present in the WinPELOC  
 '              directory specifing the parameters for the thumb drive.  
 '              1) Partition and Format the USB Thumb Drive  
 '              2) Select the WIM file  
 '              3) Prompt to remove and reinsert the thumb drive  
 '              4) Copy the OS down to the thumb Drive and prompt when complete  
 '              5) Cleanup Global Variables  
 '*******************************************************************************  
 Option Explicit  

 REM Define Global Constants  
 CONST WinPELoc = "c:\winpe"  

 REM Define Global Variables  
 DIM strImageName : Set strImageName = Nothing  

 PartitionDisk()  
 SelectImage()  
 CopyWIM()  
 PromptThumbRemoval()  
 CopyOS()  
 Complete()  
 GlobalVariableCleanup()  

 '*******************************************************************************  
 '*******************************************************************************  

 Sub PartitionDisk()  

      REM Define Local Objects  
      DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

      REM Define Local Variables  
      DIM PartDisk : PartDisk = "diskpart.exe /s" & Chr(32) & WinPELoc & "\usbpartscript.txt"  

      oShell.Run PartDisk, 1, True  

      REM Cleanup Local Variables  
      Set oShell   = Nothing  
      Set PartDisk = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub SelectImage()  

      REM Define Local Constants  
      CONST ForAppending = 2  
      CONST strComputer  = "."  

      REM Define Local Variables  
      DIM Count      : Count = 1  
      DIM FileName   : Set FileName   = Nothing  
      DIM FileVerify : Set FileVerify  = Nothing  
      DIM objFile    : Set objFile    = Nothing  
      DIM strList    : strList = "Select an Image File:"  

      REM Define Objects  
      DIM objFSO        : Set objFSO = CreateObject("Scripting.FileSystemObject")  
      DIM objWMIService : Set objWMIService = GetObject("winmgmts:" _  
                          & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")  
      DIM colFileList   : Set colFileList = objWMIService.ExecQuery _  
                          ("ASSOCIATORS OF {Win32_Directory.Name=" & Chr(39) & WinPELoc & Chr(39) & "} Where " _  
                          & "ResultClass = CIM_DataFile")  

      REM Get List of WIM files  
      For Each objFile In colFileList  
           FileVerify = Right(objFile.Name, 3)  
           If FileVerify = "wim" then  
                FileName = Len(objFile.Name)  
                FileName = FileName - 9  
                FileName = Right(objFile.Name, FileName)  
                strList = strList & vbCrLf & Count & " - " & FileName  
                Count = Count + 1  
           End If  
           Set FileVerify = Nothing  
      Next  
      REM Select WIM File  
      strImageName = InputBox(strList, "Image")  
      strImageName = CInt(strImageName)  
      REM ReInitialize Variables  
      Count = 1  
      Set FileName = Nothing  
      Set FileVerify = Nothing  
      Set objFile = Nothing  
      REM Get File Name  
      For Each objFile In colFileList  
           FileVerify = Right(objFile.Name, 3)  
           If FileVerify = "wim" then  
                FileName = Len(objFile.Name)  
                FileName = FileName - 9  
                FileName = Right(objFile.Name, FileName)  
                If Count = strImageName then  
                     strImageName = FileName  
                End If  
                Count = Count + 1  
           End If  
           Set FileVerify = Nothing  
      Next  

      REM Cleanup Local Variables  
      Set colFileList   = Nothing  
      Set Count         = Nothing  
      Set FileName      = Nothing  
      Set FileVerify    = Nothing  
      Set objFile       = Nothing  
      Set objFSO        = Nothing  
      Set objWMIService = Nothing  
      Set strList       = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub CopyWIM()  

      REM Define Local Objects  
      DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

      REM Define Local Variables  
      DIM CopyFile : CopyFile = "xcopy" & Chr(32) & WinPELoc & "\" & strImageName & Chr(32) & WinPELoc & "\iso\sources\boot.wim /y"  

      oShell.Run CopyFile, 1, True  

      REM Cleanup Local Variables  
      Set CopyFile = Nothing  
      Set oShell   = Nothing  

      End Sub  

 '*******************************************************************************  

 Sub PromptThumbRemoval()  

      MsgBox("Remove and Re-enter USB Thumb Drive. Press any key to continue")  

 End Sub  

 '*******************************************************************************  

 Sub CopyOS()  

      REM Define Local Objects  
      DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

      REM Define Local Variables  
      DIM CopyFiles : Set CopyFiles = Nothing

      CopyFiles = "xcopy" & Chr(32) & WinPELoc & "\iso\*.* /s /e /f e:\"  
      oShell.Run CopyFiles, 1, True  
      CopyFiles = "xcopy" & Chr(32) & WinPELoc & "\iso\*.* /s /e /f f:\"  
      oShell.Run CopyFiles, 1, True  

      REM Cleanup Local Variables  
      Set oShell    = Nothing  
      Set CopyFiles = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub Complete()  

      MsgBox("USB Image is Complete")  

 End Sub  

 '*******************************************************************************  

 Sub GlobalVariableCleanup()  

      Set strImageName = Nothing  

 End Sub  

27 March 2012

Staying Connected to the World for the Remote Outdoorsman

Posted By: Mick Pletcher - 3:05 PM
After a lot of thought on staying connected while adventuring through distant,remote outdoors, I finally pieced together the ultimate way to stay connected for just $81 per month. I have gotten my setup perfected and love it. It takes a little geekness, but in the end, you will never be out of contact with the urban world. This will consist of 4 types of connections to make sure you are always connected: WiFi, GSM, CDMA, and Satellite. GSM is a world-wide cellular network, while CDMA is mainly in the United States.

In order to get this setup, you will need to do the following:
  1. Purchase an unlocked GSM iPhone or Android
  2. Purchase a SPOT Connect to pair with the smart phone
  3. Purchase a CDMA MiFi hot spot (5 GB limit)
  4. Open an account with Line2 VoIP service (Unlimited Calls and Texts)
  5. Purchase an AT&T GoPhone SIM off of eBay
  6. Purchase a really old i series Motorola phone, such as an i290 if you intend to use an iPhone
  7. Setup the GoPhone cell plan with AT&T. I have it detailed on how to set this up here.
Now that you have completed these steps, you can download the Line2 and SPOT Connect apps for the phone. The AT&T service is activated, SPOT Connect is registered, and the Verizon MiFi device is up and running. This makes the phone do it's primary communications through the MiFi device over IP, using Line2 as the principal phone, but when you want or need to use the GSM cell service due to say no CDMA signal, the GoPhone plan is there to activate at any point. NOTE: You can continue to use the Line2 across the GSM service instead of having to use the integrated cell phone software. You just need to make sure Use 3G VoIP is enabled in the Line2 app for this to work.

Here is a cost breakdown:

Service Cost
Verizon MiFi $50
Line2 $9.95
SPOT Connect $12
GoPhone Prepaid $4
GoCare Insurance $4.92
Total $80.87

26 March 2012

Accessing HKCU and HKCR from Remote Registry

Posted By: Mick Pletcher - 11:17 AM
When you open registry editor and connect to a remote system, the only hives you will see are HKEY_LOCAL_MACHINE and HKEY_USERS. The other two hives, HKEY_CLASSES_ROOT and HKEY_CURRENT_USER are there too, but are under the two visible hives. So for all purposes, I am only going to explain here how to access the once that are not openly evident.

HKEY_CLASSES_ROOT
This hive is located under HKEY_LOCAL_MACHINE\SOFTWARE\Classes

HKEY_CURRENT_USER
This hive is more tricky to find because you have to correlate what the SID is to the user. This  can be done by going to HKEY_USERS and parsing through each SID. Ignore the SIDs that have only 4 sets of numbers (i.e. S-1-5-18). These are system accounts. The best way I found to parse through and find who the user is is to go to HKEY_USERS\<SID>\Software\Microsoft\Windows\CurrentVersion\Run. Under this key will be a list off applications that are set to run when the system is booted up. You can look at the data field and there will usually be a few apps that will say "c:\users\<username>", which will give away who the user of that SID is.

There is another way and that would be to remotely run a WMI query to find out who the current user is and the SID for that user.

08 March 2012

Microsoft Office 2010 Deployment Script

Posted By: Mick Pletcher - 10:08 AM
As all deployment administrators know, deploying huge packages to laptop users is a challenge because of users possibly being in meetings with clients and such. To rectify these issues, the best method I have found is being interactive with the laptop users. So for Office 2010, I wrote this interactive VB script that prompts laptop users with the option of whether to install office at that time. As we know, some users will click no indefinitely, so I have also included a mandatory date in the script that if it runs on or after that date, there is no prompt and installation begins. This script was also written for deploying to desktop systems, as when it detects that the system is not a laptop, it automatically starts the installation.

You can download the install script from here.


 '*******************************************************************************  
 '      Author: Mick Pletcher  
 '        Date: 03 January 2012  
 '    Modified:   
 '  
 ' Description: This will install Office 2010 & extensions. It gives laptop users  
 '              the option to install Office at their leisure until the mandatory  
 '              installation date specified in global variable ManDate, at which  
 '              point office will automatically install.   
 '              1) Define the relative installation path  
 '              2) Create the Log Folder  
 '              3) Detect the chassis type  
 '              4) If Laptop  
 '                 a) Check if mandatory installation date  
 '                 b) If not mandatory installation, get user approval  
 '              5) If approved  
 '                 a) Close programs  
 '                 b) Uninstall 2007 components  
 '                 c) Install Office 2010  
 '                 d) Install Primary Interop Assemblies  
 '                 e) Install Visual Studio 2010 Tools for Office  
 '                 f) Install Visio Viewer 2010  
 '                 g) Install Live Meeting Addin  
 '                 h) If Laptop, display completion message, else end with error 1  
 '              6) Copy AIA files if present  
 '              7) Cleanup Global Variables  
 '*******************************************************************************  
 Option Explicit  

 REM Define Global Constants  
 CONST TempFolder    = "c:\temp\"  
 CONST LogFolderName = "MSOF2010"  

 REM Define Global Variables  
 DIM IsLaptop     : Set IsLaptop     = Nothing  
 DIM LogFolder    : LogFolder        = TempFolder & LogFolderName & "\"  
 DIM ManDate      : ManDate          = "31-Mar-12"  
 DIM Mandatory    : Set Mandatory    = Nothing  
 DIM RelativePath : Set RelativePath = Nothing  
 DIM UserApprove  : Set UserApprove  = Nothing  

 REM Define the relative installation path  
 DefineRelativePath()  
 REM Create the Log Folder  
 CreateLogFolder()  
 REM Detect Chassis Type  
 DetectChassis()  
 If IsLaptop Then  
   REM Check Mandatory Date  
   CheckMandatoryDate()  
   REM Prompt for User Approval of Installation  
   If NOT Mandatory Then  
      GetUserApproval()  
   End If  
 Else  
   UserApprove = True  
 End If  
 If UserApprove Then  
   REM Close Communicator  
   CloseProgs()  
   REM Uninstall 2007 Components  
   UninstallComponents()  
   REM Install Office 2010  
   InstallOffice()  
   REM Install Primary Interop Assemblies  
   InstallPIA()  
   REM Install Visual Studio 2010 Tools for Office  
   'InstallVSTOR()  
   REM Install Visio Viewer 2010  
   InstallVisioViewer()  
   REM Install LM Addin Pack  
   InstallLMAddin()  
   If IsLaptop Then  
      REM Installation Complete Message  
      InstallationComplete()  
   End If  
 Else  
   GlobalVariableCleanup()  
   WScript.Quit (1)  
 End If  
 CopyAIAFile()  
 REM Cleanup Global Variables  
 GlobalVariableCleanup()  

 '*******************************************************************************  
 '*******************************************************************************  

 Sub DefineRelativePath()  

  REM Get File Name with full relative path  
  RelativePath = WScript.ScriptFullName  
  REM Remove file name, leaving relative path only  
  RelativePath = Left(RelativePath, InStrRev(RelativePath, "\"))  

 End Sub  

 '*******************************************************************************  

 Sub CreateLogFolder()  

  REM Define Local Objects  
  DIM FSO : Set FSO = CreateObject("Scripting.FileSystemObject")  

  If NOT FSO.FolderExists(TempFolder) then  
  FSO.CreateFolder(TempFolder)  
  End If  
  If NOT FSO.FolderExists(LogFolder) then  
  FSO.CreateFolder(LogFolder)  
  End If  

  REM Cleanup Local Memory
  Set FSO = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub DetectChassis()  

  REM Define Local Constants  
  CONST strComputer = "."  

  REM Define Local Objects  
  DIM objWMIService : Set objWMIService = GetObject("winmgmts:" _  
                      & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")  
  DIM colChassis    : Set colChassis = objWMIService.ExecQuery _  
                      ("Select * from Win32_SystemEnclosure")  

  REM Define Local Variables  
  DIM objChassis     : Set objChassis     = Nothing  
  DIM strChassisType : Set strChassisType = Nothing  

  For Each objChassis in colChassis  
      For Each strChassisType in objChassis.ChassisTypes  
         Select Case strChassisType  
         Case 1  
            REM "Other"  
            IsLaptop = False  
         Case 2  
            REM "Unknown"  
            IsLaptop = False  
         Case 3  
            REM "Desktop"  
            IsLaptop = False  
         Case 4  
            REM "Low Profile Desktop"  
            IsLaptop = False  
         Case 5  
            REM "Pizza Box"  
            IsLaptop = False  
         Case 6  
            REM "Mini Tower"  
            IsLaptop = False  
         Case 7  
            REM "Tower"  
            IsLaptop = False  
         Case 8  
            REM "Portable"  
            IsLaptop = True  
         Case 9  
            REM "Laptop"  
            IsLaptop = True  
         Case 10  
            REM "Notebook"  
            IsLaptop = True  
         Case 11  
            REM "Handheld"  
            IsLaptop = True  
         Case 12  
            REM "Docking Station"  
            IsLaptop = True  
         Case 13  
            REM "All-in-One"  
            IsLaptop = True  
         Case 14  
            REM "Sub-Notebook"  
            IsLaptop = True  
         Case 15  
            REM "Space Saving"  
            IsLaptop = False  
         Case 16  
            REM "Lunch Box"  
            IsLaptop = False  
         Case 17  
            REM "Main System Chassis"  
            IsLaptop = False  
         Case 18  
            REM "Expansion Chassis"  
            IsLaptop = False  
         Case 19  
            REM "Sub-Chassis"  
            IsLaptop = False  
         Case 20  
            REM "Bus Expansion Chassis"  
            IsLaptop = False  
         Case 21  
            REM "Peripheral Chassis"  
            IsLaptop = False  
         Case 22  
            REM "Storage Chassis"  
            IsLaptop = False  
         Case 23  
            REM "Rack Mount Chassis"  
            IsLaptop = False  
         Case 24  
            REM "Sealed-Case PC"  
            IsLaptop = False  
         Case 65  
            REM "Tablet"  
            IsLaptop = True  
         Case Else  
            REM "Unknown"  
            IsLaptop = False  
         End Select  
      Next  
  Next  

  REM Cleanup Local Variables  
  Set objChassis     = Nothing  
  Set objWMIService  = Nothing  
  Set colChassis     = Nothing  
  Set strChassisType = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub CheckMandatoryDate()  

  REM Define Local Variables  
  DIM Diff  : Set Diff = Nothing  
  DIM Today : Today    = Date  

  Diff = DateDiff("d", Today, ManDate)  
  If (Diff < 0) or (Diff = 0) then  
     Mandatory  = True  
     UserApprove = True  
  Else  
     Mandatory = False  
  End If  

  REM Cleanup Local Memory 
  Set Diff  = Nothing  
  Set Today = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub GetUserApproval()  

   MsgBox "The following box will ask if you want to upgrade to Microsoft Office 2010. It will close out " &_  
          "all of your office applications, including Microsoft Communicator. If you " &_  
          "choose to not install, you will be prompted daily until the mandatory installation date of " &_  
          ManDate & " at which time Office will be installed.",64,"Microsoft Office 2010 Upgrade"  
   UserApprove = MsgBox("Click OK to proceed with the Microsoft Office 2010 Installation Upgrade",1,"Microsoft Office 2010 Installation")  
   If UserApprove = "1" Then  
      UserApprove = True  
   Else  
      UserApprove = False  
   End If  

 End Sub  

 '*******************************************************************************  

 Sub CloseProgs()  

  REM Define Local Objects  
  DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

  REM Define Local Variables  
  DIM CloseCommunicator : CloseCommunicator = "taskkill.exe /IM communicator.* /F /T"  
  DIM CloseOutlook      : CloseOutlook      = "taskkill.exe /IM outlook.* /F /T"  

  oShell.Run CloseCommunicator, 1 ,True  
  oShell.Run CloseOutlook, 1, True  

  REM Cleanup Local Variables  
  Set CloseCommunicator = Nothing  
  Set CloseOutlook      = Nothing  
  Set oShell            = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub UninstallComponents()  

  REM Define Local Objects  
  DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

 REM Define Local Variables  
  DIM UninstallPath : UninstallPath = RelativePath & "Components\Uninstall\"  
  DIM Switches      : Switches      = Chr(32) & "/qn /norestart"  
  DIM WGST          : WGST          = "msiexec.exe /x" & Chr(32) & UninstallPath & "Word2007GetStartedTabSetup.msi" & Switches  
  DIM EGST          : EGST          = "msiexec.exe /x" & Chr(32) & UninstallPath & "Excel2007GetStartedTabSetup.msi" & Switches  
  DIM PPGST         : PPGST         = "msiexec.exe /x" & Chr(32) & UninstallPath & "PowerPoint2007GetStartedTabSetup.msi" & Switches  
  DIM SaveAsPDF     : SaveAsPDF     = "msiexec.exe /x" & Chr(32) & UninstallPath & "ExPdfXps.msi" & Switches  
  DIM PIA           : PIA           = "msiexec.exe /x" & Chr(32) & UninstallPath & "o2007pia.msi" & Switches  
  DIM OfficeMath    : OfficeMath    = "msiexec.exe /x" & Chr(32) & UninstallPath & "officemath.msi" & Switches  
  DIM VisioViewer   : VisioViewer   = "msiexec.exe /x" & Chr(32) & UninstallPath & "vviewer.msi" & Switches  

  oShell.Run WGST, 1, True  
  oShell.Run EGST, 1, True  
  oShell.Run PPGST, 1, True  
  oShell.Run SaveAsPDF, 1, True  
  oShell.Run PIA, 1, True  
  oShell.Run OfficeMath, 1, True  
  oShell.Run VisioViewer, 1, True  

  REM Cleanup Local Variables  
  Set UninstallPath = Nothing  
  Set Switches      = Nothing  
  Set WGST          = Nothing  
  Set EGST          = Nothing  
  Set PPGST         = Nothing  
  Set SaveAsPDF     = Nothing  
  Set PIA           = Nothing  
  Set OfficeMath    = Nothing  
  Set VisioViewer   = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub InstallOffice()  

  REM Define Local Objects  
  DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

 REM Define Local Variables  
  DIM Config  : Config  = Chr(32) & "/config" & Chr(32) & RelativePath & "config.xml"  
  DIM MSP     : MSP     = Chr(32) & "/adminfile" & Chr(32) & RelativePath & "setup.MSP"  
  DIM Install : Install = "setup.exe" & MSP & Chr(32) & Config  

  oShell.Run Install, 1, True  

  REM Cleanup Local Variables  
  Set Config  = Nothing  
  Set Install = Nothing  
  Set MSP     = Nothing  
  Set oShell  = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub InstallPIA()  

  REM Define Local Objects  
  DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

    REM Define Local Variables  
  DIM MSI        : MSI        = Chr(32) & RelativePath & "Components\o2010pia.msi"  
  DIM Log        : Log        = "PIA.log"  
  DIM Logs       : Logs       = Chr(32) & "/lvx" & Chr(32) & LogFolder & Log  
  DIM Parameters : Parameters = Chr(32) & "/qn /norestart"  
  DIM Install    : Install    = "msiexec.exe /i" & MSI & Logs & Parameters  

  oShell.Run Install, 1, True  

  REM Cleanup Local Variables  
  Set Install    = Nothing  
  Set Log        = Nothing  
  Set Logs       = Nothing  
  Set MSI        = Nothing  
  Set oShell     = Nothing  
  Set Parameters = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub InstallVSTOR()  

  REM Define Local Objects  
  DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

  REM Define Local Variables  
  DIM MSIx86     : MSIx86     = Chr(32) & RelativePath & "Components\vstor40_x86.msi"  
  DIM MSIx64     : MSIx64     = Chr(32) & RelativePath & "Components\vstor40_x64.msi"  
  DIM Logx86     : Logx86     = "VSTORx86.log"  
  DIM Logx64     : Logx64     = "VSTORx64.log"  
  DIM Logsx86    : Logsx86    = Chr(32) & "/lvx" & Chr(32) & LogFolder & Logx86  
  DIM Logsx64    : Logsx64    = Chr(32) & "/lvx" & Chr(32) & LogFolder & Logx64  
  DIM Parameters : Parameters = Chr(32) & "/qn /norestart"  
  DIM Installx86 : Installx86 = "msiexec.exe /i" & MSIx86 & Logsx86 & Parameters  
  DIM Installx64 : Installx64 = "msiexec.exe /i" & MSIx64 & Logsx64 & Parameters  

  oShell.Run Installx86, 1, True  
  oShell.Run Installx64, 1, True  

  REM Cleanup Local Variables  
  Set Installx86 = Nothing  
  Set Installx64 = Nothing  
  Set Logx86     = Nothing  
  Set Logx64     = Nothing  
  Set Logsx86    = Nothing  
  Set Logsx64    = Nothing  
  Set MSIx86     = Nothing  
  Set MSIx64     = Nothing  
  Set oShell     = Nothing  
  Set Parameters = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub InstallVisioViewer()  

  REM Define Local Objects  
  DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

  REM Define Local Variables  
  DIM MSI        : MSI        = Chr(32) & RelativePath & "Components\vviewer.msi"  
  DIM Log        : Log        = "VisioViewer.log"  
  DIM Logs       : Logs       = Chr(32) & "/lvx" & Chr(32) & LogFolder & Log  
  DIM Parameters : Parameters = Chr(32) & "/qn /norestart"  
  DIM Install    : Install    = "msiexec.exe /i" & MSI & Logs & Parameters  

  oShell.Run Install, 1, True  

  REM Cleanup Local Variables  
  Set Install    = Nothing  
  Set Log        = Nothing  
  Set Logs       = Nothing  
  Set MSI        = Nothing  
  Set oShell     = Nothing  
  Set Parameters = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub InstallLMAddin()  

  REM Define Local Objects  
  DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

  REM Define Local Variables  
  DIM MSI        : MSI        = Chr(32) & RelativePath & "Components\LMAddinPack.msi"  
  DIM Log        : Log        = "LMAddin.log"  
  DIM Logs       : Logs       = Chr(32) & "/lvx" & Chr(32) & LogFolder & Log  
  DIM Parameters : Parameters = Chr(32) & "/qn /norestart"  
  DIM Install    : Install    = "msiexec.exe /i" & MSI & Logs & Parameters  

  oShell.Run Install, 1, True  

  REM Cleanup Local Variables  
  Set Install    = Nothing  
  Set Log        = Nothing  
  Set Logs       = Nothing  
  Set MSI        = Nothing  
  Set oShell     = Nothing  
  Set Parameters = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub CopyAIAFile()  

  REM Define Local Objects  
  DIM FSO : Set FSO = CreateObject("Scripting.FileSystemObject")  

  REM Define Local Variables  
  DIM File   : File   = "ACDWordToolbars.dot"  
  DIM x86    : x86    = "C:\Program Files (x86)\Microsoft Office\Office14\STARTUP"  
  DIM x64    : x64    = "C:\Program Files\Microsoft Office\Office14\STARTUP"  
  DIM Source : Source = "\\global.gsp\data\clients\na_clients\Microsoft\MSOF2010x86\ACDWordToolbars.dot"  

  If FSO.FileExists(x86 & File) Then  
     FSO.CopyFile Source, x86  
  End If  
  IF FSO.FileExists(x64 & File) Then  
     FSO.CopyFile Source, x64  
  End If  

  REM Cleanup Local Variables  
  Set File   = Nothing  
  Set FSO    = Nothing  
  Set Source = Nothing  
  Set x86    = Nothing  
  Set x64    = Nothing  

 End Sub  

 '*******************************************************************************  

 Sub InstallationComplete()  

  MsgBox "Microsoft Office 2010 installation has now completed. Press OK to reboot", 64, "Microsoft Office 2010 Installation Complete"  

 End Sub  

 '*******************************************************************************  

 Sub GlobalVariableCleanup()  

  Set IsLaptop     = Nothing  
  Set LogFolder    = Nothing  
  Set ManDate      = Nothing  
  Set Mandatory    = Nothing  
  Set RelativePath = Nothing  
  Set UserApprove  = Nothing  

 End Sub  

06 March 2012

SMS 2003 Changing Cache Size in Windows 7 64-Bit

Posted By: Mick Pletcher - 1:32 PM
If you are in the situation we are in which you are still using SMS 2003 with Windows 7 64-Bit, there are some functions that are not compatible in SMS. For one, any function that addresses the UIResource.UIResourceMGR in a VBS script, such as change cache size, will not function in a 64-bit environment. I am pretty sure this object is accessed for other functions, but I have not had the time to parse through those to see.

I have tried workarounds with no success. For one, I have called the wscript.exe from the %systemroot%\syswow64\wscript.exe directory thinking that using the 32-bit engine would rectify this, but it did not. No errors are returned, but the script does not perform its function either. 

After contacting Microsoft, they verified that this object is definitely not compatible in Window 7 64-bit. As a last effort, I reran the MSI installer with the following command line hoping to change the cache size with no luck: msiexec.exe /i client.msi /qb- /norestart SMSCACHESIZE=5000. The only other option I can think of, which I am not going to try is to uninstall/reinstall SMS client. The workaround I used was to use AutoIT to open up Systems Management (32-bit) [smscfgrc.cpl] and then change the cache size in there. 

Here is the AutoIT script I wrote to make the changes. I recommend deploying this only when users are logged off. 


 ;Change SMS 2003 Cache Size  
 ; Author: Mick Pletcher  
 ; Date: 06 March 2012  
 ;  
 ; Open SMS 2003 CPL  
 Run( "control C:\Windows\SysWOW64\CCM\smscfgrc.cpl" )  
 ;  
 ; Activate Tabs  
 WinWait( "Systems Management Properties" )  
 WinActivate( "Systems Management Properties" )  
 Send( "{TAB}" )  
 Sleep( 250 )  
 Send( "{TAB}" )  
 Sleep( 250 )  
 Send( "{TAB}" )  
 Sleep( 250 )  
 ;  
 ; Go to advanced Window  
 WinWait( "Systems Management Properties" )  
 WinActivate( "Systems Management Properties" )  
 Send( "{RIGHT}" )  
 Sleep( 250 )  
 Send( "{RIGHT}" )  
 Sleep( 250 )  
 Send( "{RIGHT}" )  
 Sleep( 250 )  
 ;  
 ; Change Cache Size  
 WinWait( "Systems Management Properties" )  
 WinActivate( "Systems Management Properties" )  
 Send( "{TAB}" )  
 Sleep( 250 )  
 Send( "{TAB}" )  
 Sleep( 250 )  
 Send( "{TAB}" )  
 Sleep( 250 )  
 Send( "{TAB}" )  
 Sleep( 250 )  
 Send( "5000" )  
 Sleep( 250 )  
 Send( "{Enter}" )  
 Sleep( 250 )  
 Send( "{Enter}" )  
 Sleep( 250 )  

Copyright © 2013 Mick's IT Blogs™ is a registered trademark.