Set Logon Script For Everyone in Domain | Set Logon Script For Everyone in OU

Good morning class! Today, let's set the LOGON SCRIPT for everyone in a domain or in an OU:

-run powershell (as admin)

To clear the value:

-type: get-aduser -filter * -searchbase "ou=,ou=,dc=,dc=com" |set-aduser -clear scriptpath

To set the value:

-type: get-aduser -filter * -searchbase "ou=,ou=,dc=,dc=com" |set-aduser -scriptpath ""

Or for a single user:

-type: set-aduser foo.user -clear scriptpath

-type: set-aduser foo.user -scriptpath

(ie: set-aduser foo.user -scriptpath ls)

See Logon Script for Everyone in Domain | Set Logon Script For Everyone in OU

-type: get-aduser -filter * -searchbase "ou=,ou=,dc=,dc=com" |get-aduser -properties scriptpath

Or in table form:

-type: get-aduser -filter * -searchbase "ou=,ou=,dc=,dc=com" |get-aduser -properties scriptpath |ft

Or for a single user:

get-aduser foo.user -properties scriptpath

What About More? I Want More! Like the Home Folder?

Now I already know what you are going to ask... "Can I set the HOME FOLDER as well?"

YES!!! It's a little complicated so it is in another article here: http://www.daknetworks.com/index.php/blog/390-how-to-setup-home-drives-home-folders-and-login-scripts