Multiple ways to Install software remotely
Multiple ways to Install Software remotely on Windows - Method 1 Group Policy
Multiple ways to Install Software remotely on Windows - Method 2 Third party softwares
Multiple ways to Install Software remotely on Windows - Method 3 Command line PSEXEC tool
Multiple ways to Install Software remotely on Windows - Method 4 WMI (Windows Management Instrumentation)
Multiple ways to Install Software remotely on Windows - Method 5 PowerShell Remoting
Multiple ways to Install Software remotely on Windows - Method 6 PowerShell DSC (Desired State Configuration)
Multiple ways to Install Software remotely on Windows - Method 7 Copy Portable applications
Multiple ways to Install Software remotely on Windows - Method 8 Task scheduler
This is my last article for installing software remotely If anyone find or know any other solution to install software remotely I would be happy to cover it here as method 9. I started using scheduled task lately to perform my activities remotely, and What I found about Task scheduler doesn't require any extra setup or tool, because it is already there in windows by default and even you can connect to workgroup pc easily with it. If you take example of group policy, your system should be in domain, for third party and psexec you will need to download and use them, for powershell PS remoting must be enabled to work on remote server.
You can use it in below scenarios.
Its very easy to connect to schedule task remotely, setup a schedule and you are done. Best thing about it is you can schedule it, In this article I will be showing Patch or Hotfix installation remotely. To install patches in unattended mode, we will need to find parameters, to find them open command prompt or run type the hotfix file name and extension and append /h for help as shown below. (Here i am installing PowerShell upgrade remotely)
Now this was the GUI version, How you can achieve the same with command line.
There is a inbuilt tool called schtask.exe below is the creation example. Green marked area you can change as per your need.
schtasks.exe /create /S client001 /RU vcloud\vKunal /RP Computer@1 /SC Once /TN InstallProgram /TR "\\ad001\Softwares\PowershellV3\Powershell v3 Windows6.1-KB2506143-x64.msu /quiet /norestart" /ST 13:30
It will create one schedule task. Next you can run it through same command schtasks.exe.
schtasks.exe /run /S client001 /TN InstallProgram
Beauty of Task scheduler is you can even schedule it through Group Policy if you don't want to go with command line or scripting.
Multiple ways to Install Software remotely on Windows - Method 1 Group Policy
Multiple ways to Install Software remotely on Windows - Method 2 Third party softwares
Multiple ways to Install Software remotely on Windows - Method 3 Command line PSEXEC tool
Multiple ways to Install Software remotely on Windows - Method 4 WMI (Windows Management Instrumentation)
Multiple ways to Install Software remotely on Windows - Method 5 PowerShell Remoting
Multiple ways to Install Software remotely on Windows - Method 6 PowerShell DSC (Desired State Configuration)
Multiple ways to Install Software remotely on Windows - Method 7 Copy Portable applications
Multiple ways to Install Software remotely on Windows - Method 8 Task scheduler
This is my last article for installing software remotely If anyone find or know any other solution to install software remotely I would be happy to cover it here as method 9. I started using scheduled task lately to perform my activities remotely, and What I found about Task scheduler doesn't require any extra setup or tool, because it is already there in windows by default and even you can connect to workgroup pc easily with it. If you take example of group policy, your system should be in domain, for third party and psexec you will need to download and use them, for powershell PS remoting must be enabled to work on remote server.
You can use it in below scenarios.
- You don't want to use any tool.
- You don't want to setup anything extra.
- You want to schedule installation.
Its very easy to connect to schedule task remotely, setup a schedule and you are done. Best thing about it is you can schedule it, In this article I will be showing Patch or Hotfix installation remotely. To install patches in unattended mode, we will need to find parameters, to find them open command prompt or run type the hotfix file name and extension and append /h for help as shown below. (Here i am installing PowerShell upgrade remotely)
Here we will need to use parameters /quiet and /norestart as shown in windows update standalone installer screenshot.
Next Open task scheduler right click Task Scheduler > Connect to Another Computer, type the name computer you want to connect.
As you can see Task scheduler has connected to Clinet001.vlcoud.lab instead of local, Select Task Scheduler Library right click and create Basic Task.
Give some name to task, and it will trigger once only for me.
Setup some trigger time according to your need. and select start a program.
Next step is critical, Browse the program kept on shared drive. And provide parameters for silent installation, and last Finish shows summary whatever you have scheduled.
Next is very important configuration right click installpowershell and got to properties. (Without this schedule may fail)
In the properties you must select Run whether user is logged on or not and Run with highest privileges, This is self explanatory. And supply the admin user name password to run the task with.
Once this is done you just have have to wait for your schedule time or right click schedule and run right away to execute program. (Once installation is done verify on remote server and delete the schedule.) My schedule status is Ready to run.
Once I click ok status will change to running (you will have to refresh the screen by clicking on the empty space), Once you verify software is installed on remote server you can delete the schedule. There is a inbuilt tool called schtask.exe below is the creation example. Green marked area you can change as per your need.
schtasks.exe /create /S client001 /RU vcloud\vKunal /RP Computer@1 /SC Once /TN InstallProgram /TR "\\ad001\Softwares\PowershellV3\Powershell v3 Windows6.1-KB2506143-x64.msu /quiet /norestart" /ST 13:30
It will create one schedule task. Next you can run it through same command schtasks.exe.
schtasks.exe /run /S client001 /TN InstallProgram
Now verify your application has installed correctly you can check history tab of task to view any errors., Once you check application install delete it now.
schtasks.exe /delete /S client001 /TN InstallProgram /F
You can use above 3 command in one batch file and create a script for remote installation.
Beauty of Task scheduler is you can even schedule it through Group Policy if you don't want to go with command line or scripting.
if you want it to do through powershell way there are cmd let available for schedule task in windows server 2012 r2 and windows 8.1 and above. (In powershell v5).
Disable-ScheduledTask
Enable-ScheduledTask
Export-ScheduledTask
Get-ClusteredScheduledTask
Get-ScheduledTask
Get-ScheduledTaskInfo
New-ScheduledTask
New-ScheduledTaskAction
New-ScheduledTaskPrincipal
New-ScheduledTaskSettingsSet
New-ScheduledTaskTrigger
Register-ClusteredScheduledTask
Register-ScheduledTask
Set-ClusteredScheduledTask
Set-ScheduledTask
Start-ScheduledTask
Stop-ScheduledTask
Unregister-ClusteredScheduledTask
Unregister-ScheduledTask
Enable-ScheduledTask
Export-ScheduledTask
Get-ClusteredScheduledTask
Get-ScheduledTask
Get-ScheduledTaskInfo
New-ScheduledTask
New-ScheduledTaskAction
New-ScheduledTaskPrincipal
New-ScheduledTaskSettingsSet
New-ScheduledTaskTrigger
Register-ClusteredScheduledTask
Register-ScheduledTask
Set-ClusteredScheduledTask
Set-ScheduledTask
Start-ScheduledTask
Stop-ScheduledTask
Unregister-ClusteredScheduledTask
Unregister-ScheduledTask
SCHTASKS /Create [/S system [/U username [/P [password]]]]
[/RU username [/RP password]] /SC schedule [/MO modifier] [/D day]
[/M months] [/I idletime] /TN taskname /TR taskrun [/ST starttime]
[/RI interval] [ {/ET endtime | /DU duration} [/K] [/XML xmlfile] [/V1]]
[/SD startdate] [/ED enddate] [/IT | /NP] [/Z] [/F] [/HRESULT] [/?]
Description:
Enables an administrator to create scheduled tasks on a local or
remote system.
Parameter List:
/S system Specifies the remote system to connect to. If omitted
the system parameter defaults to the local system.
/U username Specifies the user context under which SchTasks.exe
should execute.
/P [password] Specifies the password for the given user context.
Prompts for input if omitted.
/RU username Specifies the "run as" user account (user context)
under which the task runs. For the system account,
valid values are "", "NT AUTHORITY\SYSTEM"
or "SYSTEM".
For v2 tasks, "NT AUTHORITY\LOCALSERVICE" and
"NT AUTHORITY\NETWORKSERVICE" are also available as well
as the well known SIDs for all three.
/RP [password] Specifies the password for the "run as" user.
To prompt for the password, the value must be either
"*" or none. This password is ignored for the
system account. Must be combined with either /RU or
/XML switch.
/SC schedule Specifies the schedule frequency.
Valid schedule types: MINUTE, HOURLY, DAILY, WEEKLY,
MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE, ONEVENT.
/MO modifier Refines the schedule type to allow finer control over
schedule recurrence. Valid values are listed in the
"Modifiers" section below.
/D days Specifies the day of the week to run the task. Valid
values: MON, TUE, WED, THU, FRI, SAT, SUN and for
MONTHLY schedules 1 - 31 (days of the month).
Wildcard "*" specifies all days.
/M months Specifies month(s) of the year. Defaults to the first
day of the month. Valid values: JAN, FEB, MAR, APR,
MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC. Wildcard "*"
specifies all months.
/I idletime Specifies the amount of idle time to wait before
running a scheduled ONIDLE task.
Valid range: 1 - 999 minutes.
/TN taskname Specifies a name which uniquely
identifies this scheduled task.
/TR taskrun Specifies the path and file name of the program to be
run at the scheduled time.
Example: C:\windows\system32\calc.exe
/ST starttime Specifies the start time to run the task. The time
format is HH:mm (24 hour time) for example, 14:30 for
2:30 PM. Defaults to current time if /ST is not
specified. This option is required with /SC ONCE.
/RI interval Specifies the repetition interval in minutes. This is
not applicable for schedule types: MINUTE, HOURLY,
ONSTART, ONLOGON, ONIDLE, ONEVENT.
Valid range: 1 - 599940 minutes.
If either /ET or /DU is specified, then it defaults to
10 minutes.
/ET endtime Specifies the end time to run the task. The time format
is HH:mm (24 hour time) for example, 14:50 for 2:50 PM.
This is not applicable for schedule types: ONSTART,
ONLOGON, ONIDLE, ONEVENT.
/DU duration Specifies the duration to run the task. The time
format is HH:mm. This is not applicable with /ET and
for schedule types: ONSTART, ONLOGON, ONIDLE, ONEVENT.
For /V1 tasks, if /RI is specified, duration defaults
to 1 hour.
/K Terminates the task at the endtime or duration time.
This is not applicable for schedule types: ONSTART,
ONLOGON, ONIDLE, ONEVENT. Either /ET or /DU must be
specified.
/SD startdate Specifies the first date on which the task runs. The
format is mm/dd/yyyy. Defaults to the current
date. This is not applicable for schedule types: ONCE,
ONSTART, ONLOGON, ONIDLE, ONEVENT.
/ED enddate Specifies the last date when the task should run. The
format is mm/dd/yyyy. This is not applicable for
schedule types: ONCE, ONSTART, ONLOGON, ONIDLE, ONEVENT.
/EC ChannelName Specifies the event channel for OnEvent triggers.
/IT Enables the task to run interactively only if the /RU
user is currently logged on at the time the job runs.
This task runs only if the user is logged in.
/NP No password is stored. The task runs non-interactively
as the given user. Only local resources are available.
/Z Marks the task for deletion after its final run.
/XML xmlfile Creates a task from the task XML specified in a file.
Can be combined with /RU and /RP switches, or with /RP
alone, when task XML already contains the principal.
/V1 Creates a task visible to pre-Vista platforms.
Not compatible with /XML.
/F Forcefully creates the task and suppresses warnings if
the specified task already exists.
/RL level Sets the Run Level for the job. Valid values are
LIMITED and HIGHEST. The default is LIMITED.
/DELAY delaytime Specifies the wait time to delay the running of the
task after the trigger is fired. The time format is
mmmm:ss. This option is only valid for schedule types
ONSTART, ONLOGON, ONEVENT.
/HRESULT For better diagnosability, the process exit code
will be in the HRESULT format.
/? Displays this help message.
Modifiers: Valid values for the /MO switch per schedule type:
MINUTE: 1 - 1439 minutes.
HOURLY: 1 - 23 hours.
DAILY: 1 - 365 days.
WEEKLY: weeks 1 - 52.
ONCE: No modifiers.
ONSTART: No modifiers.
ONLOGON: No modifiers.
ONIDLE: No modifiers.
MONTHLY: 1 - 12, or
FIRST, SECOND, THIRD, FOURTH, LAST, LASTDAY.
ONEVENT: XPath event query string.
Examples:
==> Creates a scheduled task "doc" on the remote machine "ABC"
which runs notepad.exe every hour under user "runasuser".
SCHTASKS /Create /S ABC /U user /P password /RU runasuser
/RP runaspassword /SC HOURLY /TN doc /TR notepad
==> Creates a scheduled task "accountant" on the remote machine
"ABC" to run calc.exe every five minutes from the specified
start time to end time between the start date and end date.
SCHTASKS /Create /S ABC /U domain\user /P password /SC MINUTE
/MO 5 /TN accountant /TR calc.exe /ST 12:00 /ET 14:00
/SD 06/06/2006 /ED 06/06/2006 /RU runasuser /RP userpassword
==> Creates a scheduled task "gametime" to run freecell on the
first Sunday of every month.
SCHTASKS /Create /SC MONTHLY /MO first /D SUN /TN gametime
/TR c:\windows\system32\freecell
==> Creates a scheduled task "report" on remote machine "ABC"
to run notepad.exe every week.
SCHTASKS /Create /S ABC /U user /P password /RU runasuser
/RP runaspassword /SC WEEKLY /TN report /TR notepad.exe
==> Creates a scheduled task "logtracker" on remote machine "ABC"
to run notepad.exe every five minutes starting from the
specified start time with no end time. The /RP password will be
prompted for.
SCHTASKS /Create /S ABC /U domain\user /P password /SC MINUTE
/MO 5 /TN logtracker
/TR c:\windows\system32\notepad.exe /ST 18:30
/RU runasuser /RP
==> Creates a scheduled task "gaming" to run freecell.exe starting
at 12:00 and automatically terminating at 14:00 hours every day
SCHTASKS /Create /SC DAILY /TN gaming /TR c:\freecell /ST 12:00
/ET 14:00 /K
==> Creates a scheduled task "EventLog" to run wevtvwr.msc starting
whenever event 101 is published in the System channel
SCHTASKS /Create /TN EventLog /TR wevtvwr.msc /SC ONEVENT
/EC System /MO *[System/EventID=101]
==> Spaces in file paths can be used by using two sets of quotes, one
set for CMD.EXE and one for SchTasks.exe. The outer quotes for CMD
need to be double quotes; the inner quotes can be single quotes or
escaped double quotes:
SCHTASKS /Create
/tr "'c:\program files\internet explorer\iexplorer.exe'
\"c:\log data\today.xml\"" ...
1 comment:
I want to thank you for this excellent read !! I really liked every single part of the article and I have bookmarked it to see new information in your blog.
Visit: Desktop Activity Tracking Software
Post a Comment