Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ############ Start Script #############
- # PowerShell Script to Check Citrix STA UID's
- #########################################################################################################
- # "Show STA UID's"
- # By: Keith Smith - smith.itpro@gmail.com
- # Blog: www.keithsmithonline.com
- # Date: 4/8/2013
- #########################################################################################################
- $stauidtextfile = ".\STAUID_report.txt"
- $OutFileHTM = ".\STA_UID.htm"
- $serverlistDB = ".\XA6_ServerList.txt"
- Remove-Item $stauidtextfile
- # Run Query against multiple servers, combine results
- [array]$strServers = Get-Content $serverlistDB
- foreach ($server in $strServers)
- {
- write-host "Executing query against server: " $server
- $file = "\\$server\c$\Program Files (x86)\Citrix\system32\CtxSta.config"
- $stauid = get-content $file | ? { $_ -match "UID=(.+)"} | %{$matches[1]}
- $stauid = "$stauid" + "`r`n "
- $results += out-file -filepath $stauidtextfile -append -InputObject("STAUID for " + $server + ": " + "$stauid")
- }
- # HTML Section
- $MyFile = Get-Content $stauidtextfile
- $MyFileLines = @()
- Foreach ($Line in $MyFile) {
- $MyCustomObject = New-Object -TypeName PSObject
- Add-Member -InputObject $MyCustomObject -Type NoteProperty -Name "XA6 Secure Ticket Authorities" -Value $Line
- $MyFileLines += $MyCustomObject
- }
- $MyFileLines | ConvertTo-Html -Property "XA6 Secure Ticket Authorities" -title "XA6 Secure Ticket Authorities" | Out-File $OutFileHTM
- Invoke-Item $OutFileHTM
- # Remove txt file
- Remove-Item $stauidtextfile
- write-host "Results are saved in : " $OutFileHTM
- ############# End Script ###############
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement