script 1 powershell

1
* remove_server_from_app.ps1 – Este script faz o processo inverso do script acima, seguindo exatamente o mesmo padrão de lista de ícones, lista de servidores e arquivo de log. #script to remove servers from a list of applications #created by thalesdias ([email protected] m) 2014/12/05 #this is the list of apps to be changed – one app per list $apps = get-content “D:\scripts\add_remove_apps\apps.txt” #get the date and time to edit the result file – used only for logging purpose – DONT TOUCH THIS $currdate = Get-Date #format the name of result file $resultremoved = “D:\scripts\result_removed”+”-“+$currdate.month+”-“+$currdate.day+”- “+$currdate.year+”-“+$currdate.hour+”-“+$currdate.minute+”-“+$currdate.second+”.csv” foreach ($app in $apps) { #This will remove specific servers from the application Remove-XAApplicationServer -BrowserName $app -ServerNames “server1” , “server2” #This will generate the list with result Get-XAApplicationReport $app | Select BrowserName, @{n=”Servers”;e={[string]::join(” ; “, $_.ServerNames)}} | Export-Csv -NoTypeInformation -Append $resultremoved }

Upload: thales-dias

Post on 12-Apr-2016

4 views

Category:

Documents


2 download

DESCRIPTION

script para uso em citrix xenapp 6.5

TRANSCRIPT

Page 1: Script 1 powershell

* remove_server_from_app.ps1 – Este script faz o processo inverso do script acima,

seguindo exatamente o mesmo padrão de lista de ícones, lista de servidores e

arquivo de log.

#script to remove servers from a list of applications

#created by thalesdias ([email protected] m) 2014/12/05

#this is the list of apps to be changed – one app per list

$apps = get-content “D:\scripts\add_remove_apps\apps.txt”

#get the date and time to edit the result file – used only for logging purpose – DONT TOUCH THIS

$currdate = Get-Date

#format the name of result file

$resultremoved = “D:\scripts\result_removed”+”-“+$currdate.month+”-“+$currdate.day+”-

“+$currdate.year+”-“+$currdate.hour+”-“+$currdate.minute+”-“+$currdate.second+”.csv”

foreach ($app in $apps)

{

#This will remove specific servers from the application

Remove-XAApplicationServer -BrowserName $app -ServerNames “server1” , “server2”

#This will generate the list with result

Get-XAApplicationReport $app | Select BrowserName, @{n=”Servers”;e={[string]::join(” ; “,

$_.ServerNames)}} | Export-Csv -NoTypeInformation -Append $resultremoved

}