daily pastebin goal
33%
SHARE
TWEET

wininfo from MaSOuD

Seb Jul 18th, 2011 (edited) 188 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. alias OSVer { return $gettok($OSGET(Name),1,124) }
  2. alias OSBuild { return $OSGet(Version) }
  3. alias OSSP { return $+(SP,$OSGet(ServicePackMajorVersion)) }
  4. alias OSReg { return $OSGet(RegisteredUser) }
  5. alias -l OSGet {
  6.   var %r
  7.   if ($com(osLoc)) { .comclose osLoc }
  8.   if ($com(osSrv)) { .comclose osSrv }
  9.   if ($com(osOS)) { .comclose osOS }
  10.   .comopen osLoc WbemScripting.SWbemLocator
  11.   if ($comerr) goto error
  12.   elseif (!$com(osLoc,ConnectServer,3,dispatch* osSrv)) goto error
  13.   elseif (!$com(osSrv,ExecQuery,3,bstr*,select $1 from Win32_OperatingSystem,dispatch* osOS)) goto error
  14.   %r = $comval(osOS,1,$1)
  15.   :error
  16.   if ($com(osLoc)) { .comclose osLoc }
  17.   if ($com(osSrv)) { .comclose osSrv }
  18.   if ($com(osOS)) { .comclose osOS }
  19.   return %r
  20. }
  21. alias WinInfo {
  22.   $iif($active ischan,say,echo -a) I'm using $OSVer $OSSP $+($chr(40),Build $OSBuild,$chr(41))
  23. }
RAW Paste Data
Top