I have a msi file which I am able to push to users connected to the network. I am able to run it from Task Scheduler in widows as an admin.
But is it possible to schedule a task from admin and run that msi file as a user in windows .
In short:
1, I am installing and msi application to users connected in the domain. (The application is getting installed)
- Run the application as a user when the users in the domain are logged on or working. (I am able to run the installed script as an admin user)
What I want is to run the installed file as the user who will or is logged in to that windows computer.
$taskName = "My Task2"
$taskDescription = "This task runs every 10 second"
# Define the task trigger
$trigger = New-ScheduledTaskTrigger -User Sanket.Wagh -AtLogOn
# Define the task action
$taskAction = New-ScheduledTaskAction -Execute "<any application path>"
#-Argument "-Command 'Write-Host Hello World'"
# Register the task
Register-ScheduledTask -TaskName $taskName -Trigger $trigger -Action $taskAction -Description $taskDescription
here user sanket.wagh
is static. I want this to be dynamic so it will be for all user where I push the script as an IT-admin
I am completely new to powershell but any help or documentations related to this would be highly appreciated.