13 lines
532 B
PowerShell
13 lines
532 B
PowerShell
#Load variables
|
|
. "C:\scripts\automatic-updates-static\Variables.ps1"
|
|
|
|
$password = Get-Content "c:\scripts\automatic-updates-static\localpassword.txt" | ConvertTo-SecureString
|
|
$username = $taskusername
|
|
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
|
|
|
|
$computernames = ($servers)
|
|
foreach($computername in $computernames)
|
|
{
|
|
Invoke-Command -ScriptBlock{Get-ScheduledTask -TaskName "Automatic-Updates-updatescript" | Start-ScheduledTask} -ComputerName $computername -Credential $credential
|
|
}
|