Common IA64 .inf file names

Since Itanium (IA64) drivers cannot be migrated from ConfigMgr 2007 into 2012, I was looking for a way to easily exclude the drivers. I considered various options and ideally I wanted a simple column that would display the Applicability > Supported Platforms.  Alas, it was not that easy.  So the best easiest route that I could come up with on short notice was to add the Drivers column for INF, and then filter based upon common IA64 .inf file names.  Below is my short list which I hope to maintain as I discover new names!

Common IA64 (ending) INF file names

  1. 645.inf
  2. 6451.inf
  3. 6064.inf
  4. 5164.inf
  5. w64.inf

For example:

INF_Example

 

Leave a comment

Fixes to Microsoft Package Source Conversion Scripts

The Microsoft PFE team blog (ConfigMgr Dogs) has a very good sample scripts  for converting Package source files to a new location.  Located from http://blogs.technet.com/b/configmgrdogs/archive/2013/05/09/package-amp-application-source-modification-scripts.aspx

However, I have found a couple of logical bugs.  The first is that when using the command “Set-CMPackage -Name $Package.Name -Path $ChangePath”, this will cause ALL packages with the same name to be converted over to the same value as listed by $ChangePath .  Instead of using parameter “-Name $Package.Name”, this code needs to use “-Id $Package.PackageID”.

There second and confirmed logical bug if that is caused by the package path being case sensitive such that the conversion of $OldPath to $NewPath fails (no errors generated).

Finally, as an enhancement, it would be good for packages that have already been converted to not be run again.

Below is my rendition of the script


# Original script from
# http://blogs.technet.com/b/configmgrdogs/archive/2013/05/09/package-amp-application-source-modification-scripts.aspx
# Modifications by http://t3chn1ck.wordpress.com

Write-Host "#######################################################################"
Write-Host "##        Matts ConfigMgr 2012 SP1 Package Source Modifier           ##"
Write-Host "##                blogs.technet.com/b/ConfigMgrDogs                  ##"
Write-Host "#######################################################################"

# Site Code + :
Set-Location "S01:"

$PackageArray = Get-CMPackage
$OldPath = "\\2007SERVER\source$"
$NewPath = "\\2012SERVER\cmsource$"

ForEach ($Package in $PackageArray){
   $OldPkgPath = $Package.PkgSourcePath.ToLower()

   If ($OldPkgPath.StartsWith("\\2007server")){
      $ChangePath = $Package.PkgSourcePath.ToLower()
      $ChangePath = $ChangePath.Replace($OldPath, $NewPath)

      Set-CMPackage -Id $Package.PackageID -Path $ChangePath
      Write-Host "Changed: " $Package.Name " to " $ChangePath -f Green 
   } Else {
      Write-Host "Not changed: " $Package.Name -f DarkYellow
   }
}

Leave a comment

Script to check/kill process before install

The following batch file can be used as an example of how to do a software installation/upgrade when process X is not running.  Note that also requires using PsKill from SysInternals.  The script will:

  1. Check for the existence of a running process (.exe) of the software
  2. Stop the process if detected as running
  3. Perform a software installation
  4. Then start the software again

@echo off
Set CURPATH = %~dp0

tasklist | findstr /i screenagent.exe
echo errorlevel = %ERRORLEVEL%
if ERRORLEVEL 0 goto Running
if ERRORLEVEL 1 goto DoInstall

:exit
exit 0

:DoInstall
echo Installing NICE ScreenAgent Software...
start /wait /i "NICE Agent" "%CURPATH%Setup.exe"
start ScreenAgent.exe
goto exit

:Running
echo ScreenAgent Running: stopping execution
"%CURPATH%pskill.exe" /accepteula ScreenAgent.exe
goto DoInstall

2 Comments

App-V 5.0 Script to Update Environment Path

The following script can be used as an example for to update the Windows system Environment variable PATH to include the root of the virtual file system for the package.  The script can be included as part of an App-V 5.0 dynamic configuration file (e.g. DeploymentConfig.xml).

@echo off
:: This script is intended to be embeded in an App-V 5.0 package for
::    the purpose of adding .exe files into command path.
:: It will retrive the current working directory of the script folder,
::    change the value from ending with \Scripts to \Root, and finally
::    update the PATH environment variable to include the directory path.

cls

:: Get the path of this script
set newpth=%~dp0
:: Change the value from \Scripts to \Root
set newpth=%newpth:scripts=Root\bin%
echo NEWPTH = %newpth%

:: Get existing PATH variable
for /F "tokens=2* delims= " %%f IN ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path ^| findstr /i path') do set OLD_SYSTEM_PATH=%%g

:: Determine if the new path already exists
echo.%OLD_SYSTEM_PATH% | findstr /i /c:%newpth% 1>nul

If errorlevel 1 (
  echo NEWPTH pattern not found
  setx PATH "%path%;%newpth%;" -m
) Else (
  echo NEWPTH pattern found, skipping
)

:: for troubleshooting, uncomment the pause below
:: pause

Then use this within the UserConfig of the DeploymentConfig.xml

<UserScripts>
    <PublishPackage>
        <Path>cmd.exe</Path>
        <Arguments>/c [{AppVPackageRoot}]\..\Scripts\newpath.bat</Arguments>
        <Wait RollbackOnError="true" Timeout="60"/>
    </PublishPackage>
</UserScripts>

1 Comment

App-V 5.0 Demo – Global scripting / Install Hardware Drivers

This is the walk-through for demo #4 from my Microsoft Master webcast on App-V 5.0 scripting.  For the full webcast information, visit http://t3chn1ck.wordpress.com/2014/02/03/playback-of-microsoft-master-app-v-5-0/.

This demo is on scripting the install of hardware drivers (HP printer) when an App-V package is published to a system.  For this example, I am using the standalone App-V infrastructure, not ConfigMgr 2012 R2.

  1. As you may already know, App-V does not capture drivers as part of the package.  So I’ve obtained the driver files specific to that device separately to be ready for use during my sequencing process.appv-driver-demo01
  2. Furthermore in this case, I’ve also created a simple .bat script to perform the install of the drivers since it has a longer more complex command line.  I named that file DriverInst.bat which has the following command.  Note that as part of the command line, I am giving it a custom name of the printer as “HP Univeral AppV”.
    "%~dp0Install.exe" /q /h /npf /dst /smLPT1 /n"HP Univeral AppV", 1, true
    
  3. In this instance, as part of the sequencing process, I have used a script that A) installs the software then B) makes a local copy of those driver files.  In this way, the sequencer ‘detects’ the files and adds them all as part of the package VFS.Important: since I am embedding the driver files as part of the VFS, know that this example will not work well for instances where the package is set to stream from the server.  Rather it will only work on cached copies with the full files.  If you have a streaming server, then the all driver files/installers will need to be added into the scripts folder.
    :: Install directory - C:\Program Files (x86)\HP\HP Officejet 6700
    "%~dp0OJ6700_Basicx64_1315\HP-DQEX5.exe"
    
    xcopy "%~dp0HPUPD\*" "C:\Program Files (x86)\HP\UPD\*" /YES
    
    :: Pause to verify completion
    pause
    
  4. Next we need to add the package to install as part of the DeploymentConfig.xml
    <MachineScripts>
       <PublishPackage>
          <Path>cmd.exe</Path>
          <Arguments>/c [{AppVPackageRoot}]\VFS\ProgramFilesX86\HP\UPD\DriverInst.bat</Arguments>
          <Wait RollbackOnError="true" Timeout="120"/>
       </PublishPackage>
    </MachineScripts>
    
  5. Add the package into the App-V 5.0 console as per standard process.  Follow my guideline on how to “activate” the DeploymentConfig scripts.
  6. For the webcast demo, it was PC targeted (not user) for Global publishing.  In order to quickly have the deployment synchronized with the system, we need to run the below PowerShell commands.
    Note: If UAC is enabled for the system, this will need to execute in an elevated command shell.

    Get-AppvPublishingServer | Sync-AppvPublishingServer -Global
    

Once the package is added to the system, we now show our “App-V” printer software was added as well as the printer hardware!
appv-driver-demo02

Additionally, you can see in the App-V operational events where that the .bat script was executed from within the package.
appv-driver-demo03

1 Comment

App-V 5.0 Demo – User scripting / StartProcess

This is the walk-through for demo #3 from my Microsoft Master webcast on App-V 5.0 scripting.  For the full webcast information, visit http://t3chn1ck.wordpress.com/2014/02/03/playback-of-microsoft-master-app-v-5-0/.

This demo is on scripting for a process to run when a user launches the application.  I’m using the game of Sudoku (obtained from SourceForge) and when it is launched by the user, it opens a text file on the “rules” of the game.  For this example, I am using the standalone App-V infrastructure, not ConfigMgr 2012 R2.

  1. The package has already been sequenced.  It’s just a simple set of files (and the main .exe) that I copied into the Program Files directory.  After sequencing, I added the PowerShell script to perform the operation.appv-sudoku-demo01
  2. The PowerShell script will obtain it’s current working directory and then execute the text file specified.
    
    function Get-ScriptDirectory {
      $Invocation = (Get-Variable MyInvocation -Scope 1).Value
      Split-Path $Invocation.MyCommand.Path
    }
    
    $vfsPath = Join-Path (Get-ScriptDirectory) ""
    write-host $vfsPath
    
    Set-Location $vfsPath
    Invoke-Item "Sudoku Rules.txt"
    
  3. In the UserConfig.xml we define that whenever Sudoku.exe is launched, then App-V will execute powershell.exe with the command line to run our .ps1 script.
    <UserScripts>
       <StartProcess RunInVirtualEnvironment="false">
          <Path>powershell.exe</Path>
          <Arguments>-ExecutionPolicy Bypass -File "[{AppVPackageRoot}]\..\Scripts\OpenRules.ps1"</Arguments>
          <Wait RollbackOnError="true"/>
          <ApplicationId>[{AppVPackageRoot}]\Sudoku.exe</ApplicationId>
       </StartProcess>
    </UserScripts>
    
  4. Now add the package into the App-V console and assign to a user group as per standard process.  Then follow my guideline on how to activate the custom UserConfig scripts.  Finally, with the test user, update the App-V client so that Sudoku becomes available.

Once Sudoku is launched, the PowerShell script will very quickly execute (so fast that I cannot capture a screen shot).  But we will have the text file open with rules for learning how to play the game!

appv-sudoku-demo02

Furthermore, the App-V operational events show execution of the script.

appv-sudoku-demo03

1 Comment

App-V 5.0 Standalone – How to Activate Deployment Scripts

This is the walk-through in preparation for demonstrations from my Microsoft Master webcast on App-V 5.0 scripting.  For the full webcast information, visit http://t3chn1ck.wordpress.com/2014/02/03/playback-of-microsoft-master-app-v-5-0/.

This demo will show how to “activate” a deployment script (which may contain either user or global/PC scripts) that you may have added to the DeploymentConfig.xml of an App-V package.

  1. In your the App-V web console, locate the package and click Editappv-dep-scripts01
  2. For the deployed user or computer group, click Edit Default Config
    Note: do not select the drop-down option for “Custom” as this is only for activating UserScriptsappv-dep-scripts02
  3. On the Default Configuration pane, select Advanced from the left-side menu, the click Import and Overwrite this Configurationappv-dep-scripts03
  4. Locate and open the DeploymentConfig.xml
    Important: due some irregularities with Silverlight, after opening the XML, the console may revert back to the main package administration pane.  You’ll need to navigate back to the Advanced configuration (e.g. repeat steps 1-3 above).appv-dep-scripts04
  5. In the window, select to Overwrite the configurationappv-userscripts05

4 Comments

Follow

Get every new post delivered to your Inbox.

Join 86 other followers