View difference between Paste ID: iDjmnsiU and dHzz11ci
SHOW: | | - or go back to the newest paste.
1
############ Start Script #############
2
3
# PowerShell Script to Check Citrix STA UID's
4
5
#########################################################################################################
6
# "Show STA UID's"
7
# By: Keith Smith - smith.itpro@gmail.com
8
# Blog: www.keithsmithonline.com
9
# Date: 4/8/2013
10
#########################################################################################################
11
12
13
14
$stauidtextfile = ".\STAUID_report.txt" 
15
$OutFileHTM = ".\STA_UID.htm" 
16
$serverlistDB = ".\XA6_ServerList.txt"
17
18
Remove-Item $stauidtextfile
19
20
# Run Query against multiple servers, combine results
21
[array]$strServers = Get-Content $serverlistDB
22
 
23
 foreach ($server in $strServers)
24
{ 
25
        write-host "Executing query against server: " $server
26
		$file = "\\$server\c$\Program Files (x86)\Citrix\system32\CtxSta.config"
27
		$stauid = get-content $file | ? { $_ -match "UID=(.+)"} | %{$matches[1]}
28
		$stauid = "$stauid" + "`r`n "     
29
		$results += out-file -filepath $stauidtextfile -append -InputObject("STAUID for " + $server + ": " + "$stauid")
30
		
31
}
32
33
# HTML Section
34
35
$MyFile = Get-Content $stauidtextfile
36
$MyFileLines = @()
37
Foreach ($Line in $MyFile) {
38
 $MyCustomObject = New-Object -TypeName PSObject
39
 Add-Member -InputObject $MyCustomObject -Type NoteProperty -Name "XA6 Secure Ticket Authorities" -Value $Line
40
 $MyFileLines += $MyCustomObject
41
}
42
$MyFileLines | ConvertTo-Html -Property "XA6 Secure Ticket Authorities" -title "XA6 Secure Ticket Authorities" | Out-File $OutFileHTM
43
Invoke-Item $OutFileHTM
44
45
46
# Remove txt file
47
Remove-Item $stauidtextfile
48
49
write-host "Results are saved in : " $OutFileHTM
50
51
52
############# End Script ###############