Overview
Scheduled tasks are a reliable and common way of deploying software in any scale from a few machines to hundreds. It is included with all versions of Windows and requires no special installation or programming. There are several ways to create a scheduled task. In this post, we will be looking at scheduling a task using PowerShell to deploy RightSight service and MeetUp firmware with just a few command line arguments.PowerShell scheduled tasks
The script uses a pipeline to deploy to systems. This means you can use a CSV, Text File, or a comma separated list in the PowerShell Command, anything that contains a name of a computer. There are two ways to then execute the scheduled tasks, on demand or at a specific time. Remember that schedule tasks are based on the time of the local machine. You can find more details on using PowerShell and scheduled tasks at: https://docs.microsoft.com/powershell/module/scheduledtasks/?view=win10-psPreparation Steps
- Remote PowerShell is enabled
- The computer is on the domain (not a requirement, but simplifies the process)
- Your account has the required permission to create a scheduled task (Power User at least)
- A file share containing the execution batch script and the installer file for example \\server\share\fwupdater.
- Download the Logitech Software and Firmware, this is the MeetUp Firmware Upgrade from: https://support.logi.com/hc/articles/360024844233-Downloads-MeetUp-ConferenceCam
- The PowerShell installer script which can be found at: https://github.com/youseeadam/Create-ScheduledTask
- You will also need the install-rightsight.ps1 script found at: https://github.com/youseeadam/Install-RightSight
- The account running the script has access to the file share or the computer name (though this will require a larger level of work preparing the shared directory)
Process
- Create a filter for machines to deploy the scheduled task. This can be a CSV file, an Active Directory Query, a list of machines separated by commas, etc…
- Pipe the above statement into the scheduled task builder script (Create-ScheduledTasks.ps1) with options
- The script will verify usernames and passwords (this will prevent the account from being locked out), it will not verify access to the file share.
- At the scheduled time the task will copy the files from the shared location to the %temp%\fwupdate directory of the user account configured in the scheduled task
- The task will then run the installer %temp%\fwupdate\install-rightsight.ps1 -rightsight [dynamic|ocs|off]
Create the Scheduled Task
From an account that has access to the remote machine(s) run the following command. In this example the serverlist is a csv file with the header remotecomputername.import-csv serverlist.csv | select-object remotecomputername | create-ScheduledTask.ps1 -SourceFolder "\\server\share\fwupdate\" -UserName "domain\username" -RightSight Dynamic -startime "February 12, 2019 12:45:00 PM"
You can pipe from anything that will return a computer a computer name, get-adcomputer for example. But it must return a computer name (string) not an object. For example with get-adcomputer you select-object dnshostname
Parameters
RightSightHow Right Sight will be used, one of the following options
- Dynamic: Will always run Dynamic Framing
- OCS: On Call Start. It will frame only when the meeting starts. To reset to Dynamic use the home button on the control
- Off: No Framing
Pulled from Pipeline, there is no parameter for this
SourceFolder
The location that contains the firmware installer, and the install-rightsight.ps1 script. For example, \\server\share\fwupdate\
UserName
The account used for the scheduled task to run as. This must be a valid account either on the local machine or domain (using a domain account is preferred to access the file share)
StartTime
If Omitted the task can only run on-demand.
This is a DateTime value of when you want the script to execute
Any of the formats from this output: (Get-Date).GetDateTimeFormats()
Manually running the scheduled task
You can run a scheduled task from a single line.Start-ScheduledTask -TaskName "Install RightSight and MeetUp firmware" -CimSession MachineName
If you have more than one machine you can use the same filter used to deploy the scheduled task. In the below example the computer names are in a column call RemoteComputerName
import-csv serverlist.csv | foreach-object { Start-ScheduledTask -TaskName "Install RightSight and MeetUp firmware" -CimSession $_. Remotecomputername}
Scheduled task History
Scheduled tasks rely on Event Viewer for history. In some cases, this may be disabled by default. To enable this from a remote computer requires the following- The inbound firewall rule needs to be enabled: Remote Event Log Management (RPC)
- Run the following command
- wevtutil set-log Microsoft-Windows-TaskScheduler/Operational /enabled:true /r:<computername>
- If the user running the above command does not have appropriate access, you can add the /p:<password> and /u:<username options
- In a batch script the command would look like the following
- for /F %%A in (c:\scripts\roomsystems-scheduled.txt) do wevtutil set-log Microsoft-Windows-TaskScheduler/Operational /enabled:true /r:%%A
Frequently Asked Questions
There are no products available for this section
There are no Downloads for this Product
There are no Downloads for this Version
Show All Downloads