/
Invoke-RunAsLoggedOnUser
Invoke-RunAsLoggedOnUser
Run a single command through the Task Scheduler as an random signed on user or the one specified.
If no user or the user that is specified i not logged on currently, then nothing will happen
Syntax
Invoke-RunAsLoggedOnUser -command <string> -username <string> -arguments <string>
Parameters
command
command to execute
username
username of the user it should run as, if not specified will it find a logged on user. The user must be logged on physically else nothing will happen. Default is $null
arguments
argumtents for the command. Default is $null
Example
Invoke-RunAsLoggedOnUser -command 'mkdir' -arguments 'C:\Temp'
Invoke-RunAsLoggedOnUser -command 'mkdir' -arguments 'C:\Users\test\Documents' -username 'domain\username'