Pages

Monday, 5 June 2023

Import TASK scheduler from xml file

 $taskname = "Remove MSTeams (Public version)"

$taskxmlpath = "Path of the xml file"

$taskusername = "SYSTEM"

$taskexists = Get-ScheduledTask -TaskName $taskname -ErrorAction SilentlyContinue

If ($taskexists.TaskName -eq "$taskname") {

Write-host "$taskname -already exists"

}

Else {


Register-ScheduledTask -xml (Get-Content "$taskxmlpath" | Out-String) -TaskName "$taskname" -User $taskusername -Force


write-host "$tasname -registered"

}


No comments:

Post a Comment

Test2

table {     border: 1px solid #1C6EA4;     background-color: #eeeeee;     width: 100%;     text-align: center; /* Center align all text */  ...

Search This Blog