Advertisement
Guest User

Show STA UID's

a guest
Apr 9th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  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. # Date: 4/8/2013
  9. #########################################################################################################
  10.  
  11.  
  12.  
  13. $stauidtextfile = ".\STAUID_report.txt"
  14. $OutFileHTM = ".\STA_UID.htm"
  15. $serverlistDB = ".\XA6_ServerList.txt"
  16.  
  17. Remove-Item $stauidtextfile
  18.  
  19. # Run Query against multiple servers, combine results
  20. [array]$strServers = Get-Content $serverlistDB
  21.  
  22. foreach ($server in $strServers)
  23. {
  24. write-host "Executing query against server: " $server
  25. $file = "\\$server\c$\Program Files (x86)\Citrix\system32\CtxSta.config"
  26. $stauid = get-content $file | ? { $_ -match "UID=(.+)"} | %{$matches[1]}
  27. $stauid = "$stauid" + "`r`n "
  28. $results += out-file -filepath $stauidtextfile -append -InputObject("STAUID for " + $server + ": " + "$stauid")
  29.  
  30. }
  31.  
  32. # HTML Section
  33.  
  34. $MyFile = Get-Content $stauidtextfile
  35. $MyFileLines = @()
  36. Foreach ($Line in $MyFile) {
  37. $MyCustomObject = New-Object -TypeName PSObject
  38. Add-Member -InputObject $MyCustomObject -Type NoteProperty -Name "XA6 Secure Ticket Authorities" -Value $Line
  39. $MyFileLines += $MyCustomObject
  40. }
  41. $MyFileLines | ConvertTo-Html -Property "XA6 Secure Ticket Authorities" -title "XA6 Secure Ticket Authorities" | Out-File $OutFileHTM
  42. Invoke-Item $OutFileHTM
  43.  
  44.  
  45. # Remove txt file
  46. Remove-Item $stauidtextfile
  47.  
  48. write-host "Results are saved in : " $OutFileHTM
  49.  
  50.  
  51. ############# End Script ###############
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement