Skip to content

Instantly share code, notes, and snippets.

View Christwiest's full-sized avatar

Chris Twiest Christwiest

View GitHub Profile
Function fill-roid-group
{
Param (
[Parameter(Mandatory)]
$Group
)
Write-Progress -Activity "Loading AD module"
Import-Module ActiveDirectory
$user = Read-Host -Prompt 'Input User name too run the script Example DOMAIN\User'
$pass = Read-Host -AsSecureString 'Input Password of user to run the script'
$path = Read-Host -Prompt 'Path to script Example C:\Temp'
$password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
$Action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "$path\Syncing_Staging_App-v_Citrix.ps1"
$Trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay 00:00:30
Register-ScheduledTask -TaskName "App-V Full sync" -action $Action -Trigger $Trigger -RunLevel Highest -User "$user" -Password "$password"
Write-Progress -Activity "Loading App-V Module"
Import-Module AppvClient
Write-Progress -Activity "Removing App-V Packages"
Remove-AppvClientPackage -Name *
Write-Progress -Activity "Stop VDA Agent"
Stop-Service BrokerAgent -Force
Import-Module AppvClient
Write-Progress -Activity "Sync Packages"
Sync-AppvPublishingServer 1 -Global
Write-Progress -Activity "App-v Staging Registry"
$apps = Get-AppvClientPackage
[System.Collections.ArrayList]$appList = $apps
Function Get-RESWMApplications {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string]$OutputFile,
[string]$Inputfile,
[switch]$SkipExporat
)
if(-not($SkipExport)){
Write-Verbose 'Checking if RES WM Management console is running...'
#Make backup directory
$pad = "C:\Temp"
$date = Get-Date
$date = $date.ToString("dd-MM-yyyy")
New-Item -ItemType directory -Path "$Pad\Backup-$date"
$backupfolder = "$Pad\Backup-$date"
#Create building blocks
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportAPPLICATION.XML /type:APPLICATION" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportAUTOMATIONTASK.XML /type:AUTOMATIONTASK" -Wait