Skip to content

Instantly share code, notes, and snippets.

@jpadams
Last active August 29, 2015 13:56
Show Gist options
  • Save jpadams/8903113 to your computer and use it in GitHub Desktop.
Save jpadams/8903113 to your computer and use it in GitHub Desktop.
node nonrootuser {
file { 'C:\Users\nonrootuser\Desktop\nonroot_Puppet_Agent_run_30m.xml':
ensure => file,
}
exec { 'myscript':
command => 'C:\Windows\System32\schtasks.exe /Create /XML C:\Users\nonrootuser\Desktop\nonroot_Puppet_Agent_run_30m.xml /RU WINDOWS\nonrootuser /RP Pupp3t! /tn nonroot_puppet_agent_run',
unless => 'C:\Windows\System32\schtasks.exe /Query /TN nonroot_puppet_agent_run',
require => File[ 'C:\Users\nonrootuser\Desktop\nonroot_Puppet_Agent_run_30m.xml' ],
}
}
user { 'nonrootuser':
ensure => 'present',
groups => ['Users', 'Remote Desktop Users', 'Performance Log Users'],
}
http://windows.microsoft.com/en-us/windows/user-groups#1TC=windows-7
http://www.power-programming.co.uk/post/2010/11/18/Task-Scheduler-This-task-requires-that-the-user-account-specified-has-Log-on-as-batch-job-rights.aspx
http://msdn.microsoft.com/en-us/library/ms813942.aspx
http://superuser.com/questions/485563/how-to-import-a-scheduled-task-from-an-xml-file
http://technet.microsoft.com/en-us/library/cc755659%28WS.10%29.aspx
http://technet.microsoft.com/en-us/library/cc736516(v=ws.10).aspx
https://tickets.puppetlabs.com/browse/PE-2777
http://docs.puppetlabs.com/guides/scaling.html
puppet agent --onetime
http://stackoverflow.com/questions/11607389/how-to-view-user-privileges-using-windows-cmd
http://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line
in powershell you can use echo Exit Code is $LastExitCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment