Q. How can a script return the logged on user's Passport?

I have scripted GetPassport.bat to return the logged on user's Passport.

The syntax for using GetPassport.bat is:

\[Call\] GetPassport Passport

Where Passport is a call directed environment variable that will contain the logged on user's Passport. If no Passport is found, Passport will contain NONE.

GetPassport.bat contains:

@echo off
if \{%1\}==\{\} @echo Syntax GetPassport Passport&goto :EOF
if exist "%TEMP%\GetPassport.vbs" goto :doit
@echo Set objUser = CreateObject("UserAccounts.PassportManager")>"%TEMP%\GetPassport.vbs"
@echo Wscript.Echo objUser.CurrentPassport>>"%TEMP%\GetPassport.vbs"
:doit
set %1=NONE
for /f "Tokens=*" %%p in ('cscript //nologo "%TEMP%\GetPassport.vbs"') do (
 set %1=%%p
)


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish