06 Aug / 2014
Author: Sinisa Sokolic Tags: , Comments: 0

Bookmark and Share

If you are running App-V without the complete infrastructure or SCCM you normally have all your packages on a file share.
Attached you find a small script that connects to a given file share, searches for all .appv files in it and loads all the found packages on the target system. If you have connection groups this script also loads these groups afterwards.

The file structure on the file server looks like this:

App-V Packages reside here: \\FILESERVER\Appv
Connection Groups reside here: \\FILESERVER\Appv\AppV_Connection_Groups

You should take care that all of the packages in an Connection Group are available and loaded before loading the respective Connection Groups.

Here is the script. Be sure to save the script and declare the file server name as parameter when starting the script (e.g. load_appv.ps1 FILESERVERNAME):

param($fileserver="fileserver")
$Apphub='\\' + $fileserver + '\Appv'

# Import necessary Module vor App-V
Import-Module AppvClient

# Get loaded Connection Groups and remove them first
Get-AppvClientConnectionGroup | Stop-AppvClientConnectionGroup | Remove-AppvClientConnectionGroup | out-file -append $LogFile

# Get loaded packages and remove them
Get-AppvClientPackage | Stop-AppvClientPackage | Remove-AppvClientPackage

# List all files with the suffix .appv
$Result =Get-ChildItem $apphub\*_appv -recurse -Force | Where-Object { $_.Extension -match ”.appv” }

# Add, mount and publish these App-V applications
$Result | ForEach-Object {
Add-AppvClientPackage -Path $_.FullName | Mount-AppvClientPackage | Publish-AppvClientPackage -Global
}

# Add Connection Groups
# List all files with the suffix .xml and store them in array $CG
$CG =Get-ChildItem $Apphub\AppV_Connection_Groups -recurse -Force | Where-Object { $_.Extension -match ”.xml” }

# Add, mount and publish these App-V Connection Groups
$CG | ForEach-Object {
Add-AppvClientConnectionGroup -Path $_.FullName | Mount-AppvClientConnectionGroup | Enable-AppvClientConnectionGroup -Global
}

 
Further information can be found here:
https://www.virtualvibes.co.uk/app-v-5-0-standalone-mode-adding-and-publishing-a-package/
https://technet.microsoft.com/en-us/library/jj713474.aspx
https://stealthpuppy.com/creating-app-v-5-0-connection-groups-with-powershell/

16 Mar / 2013
Author: risc.blogger Tags: , Comments: 0

Bookmark and Share

Mit dem folgenden Skript können Sie automatisiert Published Applications / Desktops erstellen. Bitte beachten Sie, dass die Variablen vorher zu definieren sind.

script:

write-host “loading pssnapin for xenapp” -foregroundcolor yellow
add-pssnapin citrix* -erroraction silentlycontinue

$XA_WorkerGroupName = “$env:server_role”
$XA_WorkerGroupName = $XA_WorkerGroupName.Replace(“”, “/”)
$split = $XA_WorkerGroupName.Split(“/”)

$0 = $split[0]
$1 = $split[1]

$farm = get-XAFarm

write-host “loading variables” -foregroundcolor yellow
$XA_Description = “$env:XA_CustomDescription Silo $1 on XenApp Farm $farm”
$XA_FolderPath = “applications$env:s4_role$env:XA_AdvancedFolderPath”
$XA_WorkerGroupName = “$1”
$XA_EncryptionLevel = “Bits128”
$XA_EncryptionRequired = $true
$XA_AudioRequired = $true
$XA_AudioType = “none”
$XA_Random = get-random
$XA_ServersPath = “Servers$env:server_role”
$XA_WaitOnPrinterCreation = $false
$XA_PreLaunch = $false

$XA_EncodedIconData = Get-CtxIcon $env:XA_IconFile -Index 0

$getPA = Get-XAApplication | foreach { “$($_.FolderPath)/$($_.DisplayName)”}
$XA_PAPath = $XA_FolderPath.Replace(“”, “/”)
$PA = “$XA_PAPath/$env:XA_DisplayName”

if ($getPA -contains $PA){
write-host “Published application already exists…”
}
else{
write-host “Published application doesn’t exist. Creating published application…”
$execute = New-XAApplication -ApplicationType $env:XA_ApplicationType -PreLaunch $XA_PreLaunch -FolderPath $XA_FolderPath -DisplayName $env:XA_DisplayName -BrowserName “$env:XA_BrowserName$XA_Random” -Description $XA_Description -CommandLineExecutable $env:XA_CommandLineExecutable -WorkingDirectory $env:XA_WorkingDirectory -WorkerGroupName $XA_WorkerGroupName -accounts $env:XA_accounts -ClientFolder $env:XA_ClientFolder -AddToClientStartMenu $XA_AddToClientStartMenu -StartMenuFolder $env:XA_StartMenuFolder -EncryptionLevel $XA_EncryptionLevel -EncryptionRequired $XA_EncryptionRequired -AudioRequired $XA_AudioRequired -AudioType $XA_AudioType -WaitOnPrinterCreation $XA_WaitOnPrinterCreation -InstanceLimit $env:XA_InstanceLimit -EncodedIconData $XA_EncodedIconData -WindowType $env:XA_WindowType -force -erroraction silentlycontinue
if ($execute -ne $NULL){write-host “Application publishing created successfully” -foregroundcolor green}else{write-host “application publishing failed” -foregroundcolor red}

}

write-host “Clearing variables…” -foregroundcolor yellow
$XA_FolderPath = “”
$env:XA_AdvancedFolderPath = “”

16 Mar / 2013
Author: risc.blogger Tags: , , Comments: 0

Bookmark and Share

Problembeschreibung:
Fehlerhafte Konfiguration von Anwendungen oder Paketen, kann zu Fehlern beim deployment von Powershell Skripten als Anwendung führen. Die ConfigMgr Log Files sind in den meisten Fällen nicht sehr aussagekräftig, sodass die Fehlersuche sehr schwierig ist.

Fehlercode: 0x80072EE7
Fehlercode: Error ID (1)

Was Sie wissen sollten:
Auf der folgenden Seite finden Sie alle ConfigMgr Logfiles:
ConfigMgr Logfilesr

Folgendes Logfile ist wichtig für die Verteilung von Anwendungen und Paketen: %windir%System32ccmlogsCcmexec.log – Hier werden die aktivitäten des Clients und des SMS Agent Host Dienstes geschrieben.

Alle Logfiles finden Sie auf dem Client unter:
%windir%System32ccmlogs

Die verteilten Pakete können in Troubleshooting fällen im folgenden Verzeichnis auf dem Client gefunden werden und einzeln getestet werden:
%windir%System32ccmcache

Lösung:
Erstellen Sie ein “SCCM Package” unter Einhaltung der folgenden Punkte:

* Definieren Sie den Store, in welchem die Source Files abgelegt werden.
* Aktivieren Sie die Option, dass die Pakete in den Cache des Clients heruntergeladen werden.
* Tragen Sie im “command line” Feld das .ps1 Skript ein “Deployment.ps1” ohne angaben vom Verzeichnis.
* Das Feld “Startup Folder” muss leer bleiben.

Sobald das Paket auf den Client verteilt wird, ist dieses im lokalen Cache unter %windir%System32ccmcache zu finden.

20 Feb / 2013
Author: risc.blogger Tags: Comments: 0

Bookmark and Share

Mit dem folgenden Skript, können Sie ganz einfach eine Datei im Ordner und Unterordner suchen und durch eine neue Datei ersetzen.

$source = “sharescript_v14.ps1”
$target = “shareproject_X”
$FileName = “script_v14.ps1”

Get-ChildItem -recurse -path $target -Include $FileName | ForEach-Object {

$scriptPath = $_.FullName

Write-Host “replace file in $scriptPath”

copy-item $source $scriptPath -force

}

11 Jun / 2012
Author: risc.blogger Tags: , Comments: 0

Bookmark and Share

Es ist relativ einfach:

[Environment]::SetEnvironmentVariable(“ExampleVariable”, “Example value.”, “User”)

Ändern Sie “User” zu “Machine” um Maschinen-weite Variablen zu setzen. Vergessen Sie bitte nicht, eine neue Powershell-Sitzung zu öffnen, bevor die neu gesetzte Variable genutzt werden kann.

Sie können die gesetzten Variablen mit “set-location env:” überprüfen.

Über folgenden Link können Sie weitere Informationen erhalten:

https://www.microsoft.com/technet/scriptcenter/resources/pstips/dec07/pstip1214.mspx