I have a software application that I must deploy to the enterprise, and part of it relies on having the script run as the user's context. So my deployment script loops through all the HKU SIDs and adds to HKU{sid}\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce a value.
Name: Stage Macro Connections
Value: wscript.exe "C:\Users\{username}\appdata\local\SmartViewConnections\StagedMacro.vbs"
Part of this process also includes adding that to the default user profile, so I mount C:\Users\Default\ntuser.dat and add a similar value:
Name: Stage Macro Connections
Value: wscript.exe "%localappdata%\SmartViewConnections\StagedMacro.vbs"
I then unmount it and carry on my merry way. I use the default profile so that people who have never logged into any given PC can still take advantage of the automation accomplished with the StagedMacro.vbs.
The problem happens when a new user logs on to the computer. The RunOnce keys get executed, but I receive the following error message:
Short of targeting a batch script that dynamically pulls the username and acts as a wrapper to point to the VBS script, can anybody explain this behavior and potentially how to overcome it?