Use case – Run the script to Enable Chrome Sync disabled by Admin on every logon.
Create this powerscript and save as ScriptName.ps1
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Google\Chrome\' -Name 'SyncDisabled' -Value '0'
To run a PowerScript in Task Scheduler :
Follow this tutorial to create the Task for Task Scheduler – https://winaero.com/run-app-or-script-at-logon-with-task-scheduler-in-windows-10/
To schedule the PowerShell script, specify the following parameters:
- Action: Start a program
- Programscript: powershell
- Add arguments (optional): -File [Specify the file path to the script here]
Source:https://blog.netwrix.com/2018/07/03/how-to-automate-powershell-scripts-with-task-scheduler/
To make sure that script also runs when the PC comes out of hibernate:
This is perfectly possible. Here’s a guide for you to follow:
1) Open Task Scheduler and click on “Create a Task” to create a new task.
2) In the new panel which opens, fill the “General” tab to suit your needs.
3) Next, switch to the “Triggers” tab and choose “New”. Another Panel will open. At the top of this Panel, choose “On an event” from the drop-down menu.
4) Then choose “Custom” under Settings, and hit “New Event Filter”. Create a “Custom Event Filter” with:
Event Level: Information
Log Name: System
Source: Power-Troubleshooter
Event ID: 1
Task Scheduler Edit Events
5) That was the important part. Now switch to the Actions tab and choose the program you wish to run.
6) In Conditions tab, uncheck the option labeled “Start the task only if the computer is on AC power”.
7) Finally, save the task by clicking on OK.
Source:https://learn.microsoft.com/en-us/answers/questions/794854/run-a-program-every-time-the-computer-comes-out-of