How to Automate the creation of App-V 5.0 Connection Group Debug Commands

Hi all,

Following on from https://blogs.technet.com/b/virtualworld/archive/2013/11/21/how-to-automate-the-creation-of-app-v-5-0-debug-command-prompts.aspx post, how do we automate the creation of connection group debug commands????

Firstly you need to get the connection groups you require using Get-AppvClientConnectionGroup.

image

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\AppV_Debug_Cmds_CG"

# 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

And here it is single script that creates all connection groups debug command prompts which are registered on the machine. (Note: I’ve used the –all switch which will get all connection groups registered whether they are enabled or not)

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

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

$Packages = Get-AppVClientConnectionGroup -all

foreach($entry in $Packages){

$PacName = $entry.Name $Ver = $entry.version $PName = $PacName $PI = [string]$entry.GroupID $VI = [string]$entry.VersionID $PD = $PI + "_" + $VI

$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()

}

And there we go, connection group shortcuts created and ready to use.

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 connection group debug command prompts.

Enjoy and hope it helps.

David Falkus | Premier Field Engineer | Application Virtualization