I just wanted to let anyone who ended up seeing this question to know that I solved my problem a different way. Basically, I ended up using PSTools, and AutoIt3 scripting.
I first wrote a script in powershell to display an HTA splash screen on the login screen informing the user that there was an installation going on like so:
#Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
#$ErrorActionPreference = 0
$args = @('-accepteula', '-s', '-h', '-x', 'mshta.exe "c:\temp\splash.hta"')
$thisfolder = Split-Path -Parent $MyInvocation.MyCommand.Definition #Get's the folder you are currently in
$installpath = "C:\GOOGLE_SKETCHUP_PRO_14p0p4900\Install-Sketchup2014.cmd" #path to install (msi, exe, cmd, etc...)
Copy-Item $thisfolder\* C:\temp -Exclude *.ps1 -Recurse -Force
start-process -file c:\temp\pstools\psexec.exe -ArgumentList $args -WindowStyle Minimized #opens login splash screen
#Start-process $installpath -NoNewWindow -Wait -WindowStyle Hidden #starts the install and waits until its finished to close the splash screen
Start-Sleep 10 #To simulate an installation..
Get-Process mshta | Stop-Process -Force #closes the splash screen
Get-Process PSEXESVC | Stop-Process -Force #closes the PSExec
cmd.exe /c "rd C:\TEMP\PSTools /s /q" #removes pstools from computer
cmd.exe /c "del C:\TEMP\splash.hta /q /f" #removes splash screen files from computer
Then I used an autoIt3 script to lock the mouse and keyboard for the duration of the install by using the BlockInput() function of AutoIt3. I turned the script into an EXE so that it could be ran without autoit being installed on the machine.
Hope that helps anyone else looking for a solution to preventing user logon.
Thank you, will give this a try! Update: So I tried this on a test vm (thank god..!) and I put my computer into an infinite restart loop. What I did was basically change the userinit value to C:\temp\test.cmd and test.cmd basically just changed the background, then changed the userinit value back to C:\windows\system32\userinit.exe then logged off. But I don't think the part where it changed the value back worked. Any idea why? :\ Also, do you know if its possible to log them out, then run a script while logged out? Some installations require the user to be logged out to run. – Gawndy – 2014-06-17T14:00:03.707
My script looks something like this:
Update2: Now that I think about it, I think it's because the cmd isn't being started as an Admin therefore the script cannot edit the registry.. How would I tell the computer to start the cmd as an admin on login...? – Gawndy – 2014-06-17T14:18:02.210
The registry key changes is something that should be done from an admin account executing the change remotely, and is probably not a good fit to be part of the script that you place in the userinit value. I've never used SCCM, but if I would think you could wrap these scripts around your installer, which then gets deployed to a system. – mrTomahawk – 2014-06-17T14:50:56.090