I'm putting together a powershell (running on Windows 7) which performs some configuration tasks post-image.
It uses windows forms to get some user input and then should run various tasks depending on their choice.
This runs before the computer is on the domain, so login scripts are no good.
I've tried adding
powershell c:\scripts\myscript.ps1 to
hklm\software\microsoft\windows\currentversion\run but it doesn't run.
I've also added it as a scheduled startup (and logon) task, with "highest level of privileges" and running as a machine admin.
When it runs as a startup task, it runs the first bit of the script (it creates a log file, so I can see this) but no windows form appears. Instead it behaves as if the user has clicked cancel on the form. The scheduled task reports with error:
0x41301. A bit of googling shows this means the script is still running?
Has anyone got any suggestions on how best to acheive this?