/build/static/layout/Breadcrumb_cap_w.png

5.1 anomaly: Run As User logged into console

I am very thankful for the new "Run As User" option on scripts; I don't know what I would do without it. I have Kscripts when this setting is working, but I also have a Kscript where it's not working, and I don't know why.

This Kscript has two tasks: run a VBscript that makes a change under HKEY_CURRENT_USER (I picked up this script from the Internet, but it's very simple), then create a different registry value under HKEY_CURRENT_USER to indicate the script was run once. The second task is working (on error is set to continue), but the first task, the VBscript, is not working.

If any of you have any thoughts on requirements for, or complications with, the new Run As User setting, I'd love to hear about it.

When I run the VBscript interactively, it works correctly, so I don't think there's anything wrong with the VBscript itself. But I include it here for the curious: Sande

[font="courier new"]'Set Compact Check Count to 0 -- per user
'© Kelly's Korner - 4/05

Dim myShell, OE_ID, OE_ID2, OE_SA_Key, p, p1, t, p2, p3, n, itemtype

Set myShell = CreateObject("WScript.Shell")

On Error Resume Next

t = "5.0\"
OE_ID = "HKEY_CURRENT_USER\Identities\Default User ID"
OE_ID2 = myShell.RegRead(OE_ID)
OE_SA_Key = "HKEY_CURRENT_USER\Identities\" & OE_ID2 & "\Software\Microsoft\Outlook Express\" & t & "Compact Check Count"

p = "HKCU\Identities\" & OE_ID2 & "\Software\Microsoft\Outlook Express\" & t
p = p & "Compact Check Count"
itemtype = "REG_DWORD"
n = "0"

myshell.RegWrite p, n, itemtype

p3 = "HKCU\Identities\" & OE_ID2 & "\Software\Microsoft\Outlook Express\" & t & "Dont Show Dialogs\"
p3 = p3 & "Compact Do not Ask Again"
itemtype = "REG_DWORD"
n = "1"
myshell.RegWrite p3, n, itemtype

0 Comments   [ + ] Show comments

Answers (9)

Posted by: GillySpy 14 years ago
7th Degree Black Belt
0
You may want to open a support ticket.

The first thing that I would look at is the logs in inventory for the script to see if the vbscript was executed or not found , etc.

Once it is running I would add in some debug code -- print lines,e tc.
Posted by: airwolf 14 years ago
Red Belt
0
How are you configuring the script to launch the VBS? You'll have to use cscript.exe to call the VBS - you cannot call it directly.
Posted by: snissen 14 years ago
Fourth Degree Green Belt
0
I know about VBscript: you launch the program $(KBOX_SYS_DIR)\cscript.exe with parameters $(KACE_DEPENDENCY_DIR)\compactcheck.vbs .

(I'm an experienced Windows deployment expert; just new to the KBOX.)
Posted by: airwolf 14 years ago
Red Belt
0
The $(KACE_DEPENDENCY_DIR) contains spaces (i.e. "Program Files"), so you must wrap it with quotes. Change the parameters to "$(KACE_DEPENDENCY_DIR)\compactcheck.vbs".
Posted by: snissen 14 years ago
Fourth Degree Green Belt
0
Drat! I knew that $(KACE_DEPENDENCY_DIR) contained spaces and so needed "" (like %TEMP% does), and I did it correctly in other scripts. But I forgot the quotes in this script, just like I forgot them when I posted my message.

So that was the problem. Thanks for leading me to it! Sande
Posted by: snissen 14 years ago
Fourth Degree Green Belt
0
Now I'm really confused. I have another Online Kscript whose only purpose is to display some standard Windows environment variables. I have it set to "Run as User logged into console", leaving "Allow Run While Logged Off" disabled.

I use two ways to display the %APPDATA% and %USERPROFILE% environment variables:
1. Launch "$(KBOX_SYS_DIR)\cmd.exe" with params "/c echo USERPROFILE is: %USERPROFILE%".
2. Run a batch file with the equivalent command: echo USERPROFILE is: %USERPROFILE%.

So why do these results agree that USERPROFILE is C:\Documents and Settings\LocalService, and that APPDATA is undefined? In other words, why is this running in the LocalService context, instead of the user context? Do Kscripts never run in the user context, only Online shell scripts do?
Posted by: snissen 14 years ago
Fourth Degree Green Belt
0
It looks like I can get into this LocalService state several different ways, depending on a combination of conditions:
1. Having just uninstalled/reinstalled any version of the KBOX Agent and not having rebooted yet. -or-
2. Using the 5.0 agent, logged in with any account that was not initiated from a shutdown or restart (i.e., one user logs in then logs out, the second user logs in and sees LocalService; Fast User Switching is disabled).

With the 5.1 agent, I can still get into this LocalService context (I'm not sure how), but it seems to happen much less often. So I think I'm going to have to check the context in scripts before I make any changes that depend on HKEY_CURRENT_USER or %APPDATA% being defined. What a pain. Sande
Posted by: GillySpy 14 years ago
7th Degree Black Belt
0
The 5.0 agent does not support this. Also check to make sure that the processes KBOXUserExtension.exe and watdog.exe are running when you try it in 5.1

I am interested in a reproducible, but even more interested if you open a support ticket. :)
Posted by: snissen 14 years ago
Fourth Degree Green Belt
0
Thank you. That clarification about the 5.0 agent is what I needed to know.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ