Skip to content
www.mytechnote.ru
Menu
  • Administration
    • Scripts
  • Equipment
    • Reviews
    • Instructions
  • Other
  • English
    • English
    • Русский
Menu

Automated password change of the account in the Windows Task Scheduler

When the need arises to change the password of the service account, on behalf of which tasks are operated in the Windows Task Scheduler, especially if there are many tasks, you might want to simplify this process. In this short note, I will show you how to do it quickly and easily.

A Simple Solution for Changing the Account Password in many Scheduler Tasks

To start, here are the commands you will need:

$NewTaskCreds = Get-Credential
$comps=get-adcomputer -filter {cn -like "mx0*" -and enabled -eq "True"}
#$comps=@("comp1","comp2","comp3")
foreach ($comp in $comps){
    Get-ScheduledTask -CimSession $comp.name | Where-Object { $_.Principal.UserId -eq $NewTaskCreds.UserName } | Set-ScheduledTask -User $NewTaskCreds.UserName -Password $NewTaskCreds.GetNetworkCredential().Password
    #Get-ScheduledTask -CimSession $comp.name | Where-Object { $_.Principal.UserId -eq $user }
}

 

If you need to change the password only on a single local machine, simply remove the loop and the -CimSession parameter.

Additional Resources

The script is included in a project on GitHub, which also contains a script for copying a large number of tasks to remote machines. This can be useful if you have many tasks that need to be on multiple servers.

Posted on 28.10.202330.05.2024 by sanglyb

Post navigation

← Step-by-Step Guide to Updating GitLab from Repositories
How to Check Password Expiry Date in Active Directory →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Подписывайтесь

Youtube
vk
telegram
github
twitter
rss
  • Форум
  • Об авторе
  • Поддержать автора

Популярные записи

Новые записи

  • How to Extend an LVM Partition in Linux
  • SCCM Reporting Errors After Migrating from SQL Server 2016 to 2019
  • Problem Using PassFiltEx on Older CPUs
  • How to remove attachments from old calendar events in Exchange using a script
  • How to download and install Office 2024 LTSC

Архивы

  • 2026 (3)
  • 2025 (5)
  • 2024 (7)
  • 2023 (30)
  • 2022 (4)
  • 2020 (17)
  • 2017 (82)
  • 2016 (5)
© 2015-2026 www.mytechnote.ru
Использование материалов сайта возможно только с разрешения владельца или обязательна индексируемая, прямая, передающая вес ссылка на материал.