I have been struggling with the following idea for a while: How to run a package before before a person logs on using SCCM. There is a setting in SCCM that runs when no one is logged on, but if a person reboots and logs on before SCCM fires, the package will never run. Basically I wanted the ability to make SCCM work like Software Deployment in AD (AD prevents you from logging on until software is completely installed).
The missing piece, for me, was “Active Setup”. Active Setup is pretty well documented here. Combining Active Setup with PowerShell and SCCM, I believe I can run packages before people log on (or at least before they launch any programs).
Here are my steps
- Step 1 : I need to create an Active Setup registry entry on everyone’s machine that will run a PowerShell script
- I created this PowerShell script to create the Active Setup registry entries. This will put a StubPath that launches the PowerShell script.
- Step 2 : Pop up an info message telling the user we are doing some work before the finish logging in.
- I am using this PowerShell script to display a dialog box
- Step 3 : Launch the SCCM Advertised program that you want. Since Active Setup is running as the user, you have to use SCCM to run anything that needs “administrative privileges”. The following code is used inside a PowerShell script to launch an advertisement on the local machine (you need to know the ProgramID and the PackageID):
Function JBMURPHY-SCCM-UIExecuteProgram { Param([parameter(Mandatory = $true)]$ProgramID, [parameter(Mandatory = $true)]$PackageID) $UIResource = New-Object -ComObject UIResource.UIResourceMgr $UIResource.ExecuteProgram($ProgramID, $PackageID,$true) }
Kinda complicated, but I think it will work. Have you used these methods?
We’re just migrating from our old software deployment application to Microsoft SCCM2012. We’ve got the same problem and are looking for a good workaround to install software packages before the desktop is provided to the end user. Do you have any progress in this issue? I would appreciate any response!
I have not had a chance to spend any more time on this. But there is no reason it should not work? It is not really using SCCM, just Active Setup and using that to launch the SCCM package I want. Shoudl work.
How about a scheduled task configured to run at computer startup which calls your script? This would fire the install before the user has the chance to logon.
That would run every time the user logs on. My goal was for the first time the user logs on to that machine.
I tested it and it doesn’t work anyway. To get it to run only once, I wrote as part of my install to delete the Scheduled Task. Unfortunately, the way MS designed the UIResourceMgr it will only run if a user is logged on. The scheduled task would fire the script and it could find the advertised program but it wouldn’t run. I found in execmgr.log that the task won’t run because the user isn’t logged on. I tried various user accounts (domain accounts, local accounts, the SYSTEM account) but none of them worked.
That is why I used “Active Setup”, the script will be running as that user, and UIResourceMgr should be able to run a SCCM package.
Yes, I got that, and I agree that this works perfectly to install something when a user logs on (I too use this quite often). My goal was to start the installation before the user logged on, just like we used to be able to do when we deployed software using group policy.
Thank’s for taking the time to reply! I wish there was a way to make SCCM work like group policy software deployment.
a tad late to the party, but I just use registry to set windows logon message (before they log on) to wait 5 minutes before logging on. That way the SCCM package should run fine.
HKLM
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
LegalNoticeCaption REG_SZ Dialog Caption
LegalNoticeText REG_SZ Dialog Message
See kb101063 for reference.
So what happens when a new user logs on? If the install has already run successfully is the call into UIResourceMgr ignored, or does it attempt to reinitiate the install? Or do you need to script in a removal of the HKLM Active Setup key into the package being installed?