billb3 Posted September 5, 2007 Posted September 5, 2007 Hi All, Fairly new user here, have been writing lot of scripts over the past few weeks...but I'm stumped right now. I am deploying packages using Everdream(www.everdream.com) and want my package to determine if a user is logged into the computer. If a user is logged on, I want it to popup a dialog before installing. If nobody is logged on, I want it to run my installer right away. I found this code, but this only gets some information out of the registry...and doesn't determine if that user is currently logged in. Any ideas? Thanks! --Bill CODEConst $HKEY_LOCAL_MACHINE = 0x80000002 Dim $strKeyPath, $strValueName, $strValue $strComputer = "localhost" $objRegistry=ObjGet("winmgmts:\\" & $strComputer & "\root\default:StdRegProv") $strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" $strValueName = "DefaultUserName" $objRegistry.GetStringValue ($HKEY_LOCAL_MACHINE, $strKeyPath, $strValueName, $strValue) $localuser = $strValue
BigDod Posted September 5, 2007 Posted September 5, 2007 @UserName will return the name of the currently logged on user. I am not sure what it will return if no-one is loggen on. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
billb3 Posted September 5, 2007 Author Posted September 5, 2007 That is what I was looking for, didn't know that existed. Thanks!
billb3 Posted September 5, 2007 Author Posted September 5, 2007 When deploying packages with Everdream, the @Username was returning "SYSTEM"...since that is the user the process runs as... Instead, I used the "ProcessExists()" function and checked for "explorer.exe".
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now