Share via


How to Automate the Creation of App-V 5.0 Debug Command Prompts

Hi all,

I’ve been meaning to write this for a while now and finally have found some time to write it.

Steve Thomas has written a great blog post that describes the new debug mode with the /appvve command shell switch but as described its not a easy process to create those commands.

https://blogs.technet.com/b/gladiatormsft/archive/2013/04/24/app-v-5-0-launching-native-local-processes-within-the-virtual-environment.aspx

Firstly you need to get the package you require using get-appvclientpackage.

image

If you have a long list then you need to filter that list by using something like:

get-appvclientpackage RDCMan.001 

image

Now we have the packageID and VersionID we then need to create the command, I’ve been using notepad to create mine.

image

But I have 38 packages on my machine alone, I don’t want to do this 38 times…..

image

You may have guessed…… POWERSHELL to the rescue.

The first thing we need to do is create a directory to create the debug command prompts in, so the snippet below is creating that directory on my desktop.

# Directory to create App-V Debug shortcuts $Directory = "c:\users\davidfa\Desktop\AppVDebugCMDs"

# Creating Directory Folder New-Item -ItemType directory -Path $Directory

image

Now we have the folder we need to create the debug command prompts and what were going to do is create shortcuts.

image 

The snippet below is simply filtering for RDCMan.001 using the Get-AppVClientPackage, its then creating variables for different components required for the debug command prompt.

# Getting all client packages registered in the Client Catalog $Package = Get-AppVClientPackage RDCMan.001

# Variables $PName = $Package.Name $PI = [string]$Package.PackageID $VI = [string]$Package.VersionID $PD = $PI + "_" + $VI

Now we have everything to create the shortcut. The following code creates the shortcut in the directory, it then specifies the TargetPath and WorkingDirectory and finally creates and saves the shortcut. (Note: These can be customized to whatever path you wish)

$WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Directory\$PName DebugCMD.lnk") $Shortcut.TargetPath = "c:\windows\system32\cmd.exe" $Shortcut.WorkingDirectory = "C:\windows\System32" $Shortcut.Arguments = "/appvve:$PD" $Shortcut.Save()

Once complete and ran in Powershell the debug command prompt is created and ready to use.

image

So that's great a single debug command has been created but we haven’t thought about having multiple versions of packages or multiple packages. Heres the answer…..

# Directory to create App-V Debug shortcuts $Directory = "c:\users\davidfa\Desktop\AppVDebugCMDs"

# Creating Directory Folder New-Item -ItemType directory -Path $Directory

# Getting all client packages registered in the Client Catalog $Packages = Get-AppVClientPackage -all

# Looping through each Package and creating a cmd shortcut

foreach($entry in $Packages){

$PName = $entry.Name $PI = [string]$entry.PackageID $VI = [string]$entry.VersionID $Ver = [string]$entry.Version $PD = $PI + "_" + $VI

$WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Directory\$PName $Ver DebugCMD.lnk") $Shortcut.TargetPath = "c:\windows\system32\cmd.exe" $Shortcut.WorkingDirectory = "C:\windows\System32" $Shortcut.Arguments = "/appvve:$PD" $Shortcut.Save()

}

And there we go, 38 package debug shortcuts created, with the version of the package specified in the name automatically.

image

Disclaimer

The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.

Conclusion

A simple way to automate the creation of your debug command prompts.

Enjoy and hope it helps.

David Falkus | Premier Field Engineer | Application Virtualization

Comments

  • Anonymous
    November 21, 2013
    Brilliant, thanks for the tip David! ;)

  • Anonymous
    November 21, 2013
    Thanks fo sharing this! /vkleinerde

  • Anonymous
    November 22, 2013
    Awesome script! This goes out on our App-V Clients. :) Just one thing: I see you include the /K argument in the text file, but you dropped it from the script. Putting that in there makes the shortcuts even better as you can fire off a regedit or what you want directly in one command. I changed this: $Shortcut.Arguments = "/appvve:$PD" to this: $Shortcut.Arguments = "/K /appvve:$PD"

  • Anonymous
    December 28, 2013
    As a follow up to his last article on how to automate the creation of App-V 5.0 debug command prompts

  • Anonymous
    December 28, 2013
    Microsoft’s own Dave Falkus has a great article out on how to automate the creation of App-V 5.0 debug

  • Anonymous
    December 29, 2013
    Microsoft’s own Dave Falkus has a great article out on how to automate the creation of App-V 5.0 debug

  • Anonymous
    December 29, 2013
    As a follow up to his last article on how to automate the creation of App-V 5.0 debug command prompts

  • Anonymous
    December 29, 2013
    As a follow up to his last article on how to automate the creation of App-V 5.0 debug command prompts

  • Anonymous
    December 29, 2013
    Microsoft’s own Dave Falkus has a great article out on how to automate the creation of App-V 5.0 debug