Showing posts with label current user. Show all posts
Showing posts with label current user. Show all posts

Monday, 20 May 2013

Getting Emailid and Username from Outlook



'Creating outlook application object
Set olapp=createobject("Outlook.application") 

'Get Namespace
Set objNS =olApp.GetNamespace("MAPI")  


'Current EMail ID 
msgbox objNS.Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress

'Current UserName
msgbox objNS.Session.CurrentUser


Tuesday, 14 May 2013

VBSCRIPT - GET LOGIN USERNAME

'Create Shell Object
Set shell = CreateObject("wscript.shell")

'Execute command Prompt(DOS) to get current username

Set oExec = shell.Exec("cmd.exe /c echo %username%")

'Print All output
msgbox oExec.Stdout.ReadAll
 
set oExec =nothing
set shell = nothing



OUTPUT
=======
 Current username will get displayed