Skip to content

Instantly share code, notes, and snippets.

@HerbCaudill
Last active June 22, 2019 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HerbCaudill/ea8710410afc9bb88a65f846e46d04da to your computer and use it in GitHub Desktop.
Save HerbCaudill/ea8710410afc9bb88a65f846e46d04da to your computer and use it in GitHub Desktop.
$taskName = 'Enter hours at logon'
# Path to Chrome on your machine
$chrome = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
# URL of your tab of the spreadsheet
$url = 'https://docs.google.com/spreadsheets/d/ASDFasdf12341234asdfASDFASFD1234/edit#gid=12341234'
$taskXml = @"
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<Triggers>
<LogonTrigger>
<Enabled>true</Enabled>
</LogonTrigger>
<SessionStateChangeTrigger>
<Enabled>true</Enabled>
<StateChange>SessionUnlock</StateChange>
</SessionStateChangeTrigger>
</Triggers>
<Actions Context="Author">
<Exec>
<Command>$chrome</Command>
<Arguments>--app=$url</Arguments>
</Exec>
</Actions>
</Task>
"@
Register-ScheduledTask -TaskName $taskName -Xml $taskXml -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment