HowTo: Enum Citrix Server License using LMSTAT
Our PS4 server seems to fail to execute the license information scripts from Citrix.Com (Dependency on SDK).
So instead of relying on it, I decided to develop a script using LMSTAT and a short vb script to parse the output file and write it to a .CSV file for better viewing (Data Filtering and such...)
First I piped the result of lmstat -a to a text file then I used the script below to parse the contents then write it to a .CSV file
Code Snippet:
Parse the source file (lmstat output file): srcfile
Sub GetData(srcfile)
Set f = fso.GetFile(srcfile)
Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)
Do While ts.AtEndOfStream <> True
readResults = Trim(UCase(ts.ReadLine))
If InStr(readResults, "/27000") Then
mps = split(readResults, Chr(32))
msg = mps(1) & "," & mps(3) & "," & mps(4) &amp; "," & mps(5) & mps(6) & mps(8) &amp; " " & mps(9) &amp; " " & mps(10)
WriteToCSV msg, license_out
End If
Loop
End Sub
Function WriteToCSV(oCsv,msg)
If Not fso.FileExists(oCsv) Then fso.CreateTextFile(oCsv)
Set f = fso.GetFile(oCsv)
Set ts = f.OpenAsTextStream(ForAppending, TristateUseDefault)
ts.Write msg & vbCrlf
msg = ""
ts.Close
End Function
No comments:
Post a Comment