Set objServer = CreateObject("MetaFrameCOM.MetaFrameServer")
For each objSession in objServer.Sessions
Wscript.echo objSession.ClientName & " currently " & objSession.SessionState & ", running the following applicaitons(s)"
For each objApplication in objSession.Applications
WScript.echo vbTab & objApplication.AppName
Next
Next
[/sourcecode]
UserSessionInfo.wsf
[source 1=”<job” id=”UserSessionInfo” 2=”prompt="no">” 3=”<?job” error=”false” debug=”true” 4=”?>” 5=”<comment>” 6=”File:” 7=”WhereIs.wsf” 8=”Description:” 9=”List” 10=”all” 11=”servers” 12=”a” 13=”user” 14=”is” 15=”logged” 16=”on” 17=”to.” 18=”Requirements:” 19=”WSH” 20=”5.5″ 21=”or” 22=”higher.” 23=”Copyright” 24=”(c)” 25=”2002″ 26=”Citrix” 27=”Systems,” 28=”Inc.” 29=”</comment>” 30=”<runtime>” 31=”<description>” 32=”Display” 33=”User” 34=”session” 35=”information.” 36=”</description>” 37=”</runtime>” 38=”<reference” 39=”object="MetaFrameCOM.MetaFrameFarm"/>” 40=”<script” 41=”language="VBScript">” 42=”'Option” 43=”Explicit” 44=”On” 45=”Error” 46=”Resume” 47=”Next” 48=”Dim” 49=”UserName,” 50=”theFarm,” 51=”aSession,” 52=”SessionList,” 53=”SessionCount,” 54=”UserNameU,” 55=”ShortVer,” 56=”AAName,” 57=”theUser,” 58=”theApp,” 59=”anApp,” 60=”nApCount,” 61=”MFAccountDomainUser” 62=”'” 63=”Get” 64=”user” 65=”name” 66=”UserName” 67=”=” 68=”inputBox("Enter” 69=”User” 70=”name",” 71=”"User's” 72=”Session” 73=”info")” 74=”'Converting” 75=”to” 76=”uppercase” usernameu=”Ucase(Username)” 77=”'” 78=”Initialize” 79=”the” 80=”farm” 81=”object.” 82=”Set” 83=”theFarm” 84=”=” 85=”CreateObject("MetaFrameCOM.MetaFrameFarm")” 86=”if” 87=”Err.Number” 88=”<>” 89=”0″ 90=”Then” 91=”MsgBox("Can't” 92=”create” 93=”MetaFrameFarm” 94=”object"” 95=”&” 96=”VbcrLf” 97=”&_” 98=”Err.Number” 99=”&” 100=”Err.Description” 101=”&” 102=”VbcrLf)” 103=”WScript.Quit” 104=”Err.Number” 105=”End” 106=”If” 107=”'” 108=”Initialize” 109=”the” 110=”farm” 111=”object.” 112=”theFarm.Initialize” 113=”MetaFrameWinFarmObject” 114=”'” 115=”Get” 116=”all” 117=”sessions” 118=”in” 119=”the” 120=”farm.” 121=”Set” sessionlist=”theFarm.Sessions” sessioncount=”SessionCount” 122=”For” 123=”Each” 124=”aSession” 125=”In” 126=”SessionList” 127=”If” 128=”Ucase(aSession.UserName)” 129=”=” 130=”UserNameU” 131=”Then” 132=”+” 133=”1″ 134=”CheckClient” 135=”MsgBox("User” 136=”Session” 137=”Report"” 138=”&” 139=”VbcrLf” 140=”&” 141=”VbcrLf” 142=”&_” 143=”User Name: ” 144=”&” 145=”UserName” 146=”&” 147=”VbcrLf” 148=”&_” 149=”Server Name: ” 150=”&” 151=”aSession.ServerName” 152=”&” 153=”VbcrLf” 154=”&_” 155=”Application Name: ” 156=”&” 157=”aSession.AppName” 158=”&” 159=”VbCrLf” 160=”&_” 161=”Client Name: ” 162=”&” 163=”aSession.ClientName” 164=”&” 165=”VbcrLf” 166=”&_” 167=”Client Address: ” 168=”&” 169=”aSession.ClientAddress” 170=”&” 171=”VbCrLf” 172=”&_” 173=”Client Ver: ” 174=”&” 175=”Shortver” 176=”&” 177=”VbCrLf” 178=”&_” 179=”Client SessionID: ” 180=”&” 181=”aSession.SessionID)” 182=”End” 183=”If” 184=”Next” 185=”If” 186=”sessionCount” 187=”>” 188=”0″ 189=”Then” 190=”MsgBox("User:” 191=” & UserName & ” 192=”is” 193=”having:” 194=” & SessionCount & ” 195=”Session/s")” 196=”else” 197=”MsgBox("Unable” 198=”to” 199=”find” 200=”user:” 201=”"” 202=”&” 203=”UserName)” 204=”End” 205=”if” 206=”Wscript.Quit” 207=”Sub” 208=”CheckClient” 209=”Select” 210=”Case” 211=”aSession.ClientBuild” 212=”Case” 213=”142″ shortver=”aSession.ClientBuild” 214=”Case” 215=”2600″ 216=”Case” 217=”3790″ 218=”Case” 219=”581″ 220=”Case” 221=”606″ 222=”Case” 223=”715″ 224=”Case” 225=”727″ 226=”Case” 227=”741″ 228=”Case” 229=”779″ 230=”Case” 231=”910″ 232=”Case” 233=”963″ 234=”Case” 235=”964″ 236=”Case” 237=”967″ 238=”Case” 239=”985″ 240=”Case” 241=”986″ 242=”Case” 243=”1050″ 244=”Case” 245=”1051″ 246=”Case” 247=”17534″ 248=”Case” 249=”20497″ 250=”Case” 251=”21825″ 252=”Case” 253=”22650″ 254=”Case” 255=”24737″ 256=”Case” 257=”29670″ 258=”Case” 259=”32649″ 260=”Case” 261=”37358″ 262=”Case” 263=”36280″ 264=”Case” 265=”39151″ 266=”Case” 267=”44376″ 268=”Case” 269=”50211″ 270=”Case” 271=”52110″ 272=”Case” 273=”55836″ 274=”Case” 275=”52643″ 276=”Case” 277=”02650″ 278=”Case” 279=”5357″ 280=”Case” 281=”19460″ 282=”Case” 283=”5357″ 284=”Case” 285=”31560″ 286=”Case” 287=”Else” 288=”'” 289=”End” 290=”Select” 291=”End” 292=”Sub” 293=”</script>” 294=”</job>” 295=”</package>” 296=”[/source” language=”vb”][/source]