Link to home
Start Free TrialLog in
Avatar of Pig_Trough
Pig_Trough

asked on

Is there a way to schedule changes in group policy in the future?

We want to periodically (every week or two) change the Welcome Screen when a user starts their computer.  Currently we do this by manually editing the GPO under Computer Configuration, Policies, Security Settings, Local Polcies/Security Options / Interactive Logon, and changing the Message text and the message title.

We'd prefer to automate this, i.e., every week, it would pull a new message and a title from somewhere (like a textfile or something).  We'd even be willing to put in 26 or 52 manual entries if we only had to do it once a year.  Is there any way to do this?

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As Will mentioned, you can't do it natively.   Normally GPO's are the way to go, but for this case, maybe not.

All the GPO does is edit this key on each machine:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
The values are:
LegalNoticeCaption
LegalNoticeText

You could write a script that reads the Title and Message from a file (based on the date) and push it out to all your clients.   The downside is that all your clients need to be online when it pushes the update.  You could use a GPO to execute the script, you would also have to remove the GPO setting for changing the message text and title.
Not a great way to do this with Group Policy. You could precreate GPOs with the text and use the PowerShell cmdlet set-gplkink. Basically, you would link the GPO when it is needed based on a date.
Avatar of Pig_Trough
Pig_Trough

ASKER

Well, I guess I could just build a script or .msi that could set these registry values on local machine by itself (i.e., trigger dates, Captions, and Texts would all be built into the code like in arrays), depending on the system date, and pop the appropriate variable into

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LegalNotice[Caption|Text]. Then save that to through GPO to all machines so that it's saved in autostart autostart (It would take one reboot for it to take effect).  For example:

Module Module1
    Dim strTitle As String
    Dim StrText As String
    Sub Main()
        '// I'm sure this is about the most efficient code possible; just trying to 
        '//     make it clear what I'm trying to do.

        Select Case GetWeekNo()
            Case 1  '// I don't know if I start from 1 or 0; doesn't matter
                strTitle = "Happy New Year"
                StrText = "This is the most awesome week of the year."
            Case 2
                strTitle = "Its Probably cold outside"
                StrText = "Since it's still the second week of the year, it's probably cold outside..."
            Case 3
                '***********************************
                ' ... and on and on again 50 more times {give or take}
                '***********************************
            Case 52
                strTitle = "Happy Holidays"
                StrText = "Last week of the year, it appears"
            Case Else
                strTitle = "Title"
                StrText = "Welcome"
        End Select

        With My.Computer.Registry
            .SetValue("HKEY_LOCAL_MACHINE#Microsoft#WindowsNT#CurrentVersion#WinLogon",
                                      "LegalNoticeCaption", strTitle)
            .SetValue("HKEY_LOCAL_MACHINE#Microsoft#WindowsNT#CurrentVersion#WinLogon",
                                      "LegalNoticeText", StrText)
        End With
    End Sub
    Function GetWeekNo() As Long
        '// returns the weeknumber of the current date, roughly
        Dim d1 As Date = DateSerial(Year(Now.Date), 1, 1)
        Dim d2 As Date = DateSerial(Year(Now.Date),
                                    Month(Now.Date),
                                    Day(Now.Date))
        Dim t As Long
        t = DateDiff(DateInterval.WeekOfYear, d1, d2)
        Return t
    End Function
End Module

Open in new window


Comments? (Yes, yes, other than my coding sucks...:)

It's not incredibly date sensitive; we just want to change the messages around every week or so, and I don't want to have to go in and change this manually every week.

I'm sure there's far more efficient ways to code this -- that's not exactly my question - should an approach like this work?

Also, of course, I'd have to kill the existing GPO.

Thanks!!
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.