![]() ![]() It should end up looking a bit like this:Īnd that’s about it – should run as per the Trigger Schedule. I have a script that runs everyday in Altiris that checks if files on a server are newer than files on a client, if so, copy the newer files. PowerShell.exe -ExecutionPolicy ByPass -File C:\Tools\Scripts\WSUSCleanup.ps1 The action should be configured to “Start a Program” which would be as per the command line example below (example assumes you have a script called WSUSCleanup.ps1 located in a folder called “C:\Tools\Scripts”): In order to run this as a Scheduled Task in Windows I’d need to run it as SYSTEM (NT AUTHORITY\SYSTEM) – change the “Configure for:” section at the bottom to match the OS you’re using as well, for compatibility purposes.Ĭonfigure a Trigger – once a week should be more than enough for this particular task. Out-File -FilePath C:\Tools\Scripts\wsuscleanup.log for Computer Restart and will schedule the restart as per the policy. Get-WsusServer | Invoke-WsusServerCleanup -CleanupObsoleteUpdates -CleanupUnneededContentFiles -CompressUpdates -DeclineExpiredUpdates -DeclineSupersededUpdates | ` Reboot the computer Run SCCM TriggerSchedules for DDR and Hardware Inventory. Get-WsusServer -Name $env:computername -PortNumber $WSUSPortNumber # Connect to local server using PowerShell ![]() # Set WSUS port number (standard is 8530 on Windows Server 2012 R2 but can be customised) The script I want to run looks like the following: Being a lazy bugger I like to automate as many boring, repetitive tasks as I can so PowerShell and Scheduled Tasks are my friends…Ī good example of this would be if you needed to run a cleanup of WSUS to remove declined, superseded, expired updates etc. It can be useful to have a PowerShell script which runs as a Windows Scheduled task to perform otherwise manual tasks. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |