Mass change logon script in AD
We needed to change login scripts, or rather remove ’em as we replace ’em with GPOs. I exported the current scripts to a TXT and then just cleared the field in AD.
# Load the AD module Import-module ActiveDirectory # Get all the AD user who have a login script and save it to a textfile Get-ADUser -filter * -properties scriptpath | ft Name, scriptpath > C:\LogonScript.txt -Force # Clear the Logon script field in AD Get-ADUser -Filter * -SearchBase "OU=TEST,DC=TEST,DC=local" | Set-ADUser -Clear scriptPath