ML
    • Register
    • Login
    • Search
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Server 2012 PS: Script to update script path

    IT Discussion
    serve2012 server 2012 aduc active directory pstools powershell user script path
    2
    5
    468
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gjacobse
      gjacobse last edited by gjacobse

      Looking to update the script path for all users in AD on a Server 2012.

      Getting through a search, I find this, and it dissecting it, seems like it would work. for ALL (wildcard) users in AD. But,.. before I go and actually run it,.. wanted to confirm.

      Import-module ActiveDirectory  
      Get-ADUser -Filter * -SearchBase "OU=User Accounts,DC=santhosh,DC=lab" | Set-ADUser –scriptPath “\\San01\test.bat” 
      

      As I read it

      Import-module ActiveDirectory  
      

      Get module - gotta have that

      Get-ADUser -Filter * 
      

      Get users, filter on wild card

      -SearchBase "OU=User Accounts,DC=santhosh,DC=lab"
      

      Search OU User Accounts, on DC Santhosh.lab

       | Set-ADUser –scriptPath “\\San01\test.bat” 
      

      update the script path to UNC\file

      1 Reply Last reply Reply Quote 0
      • gjacobse
        gjacobse last edited by

        breaking it down like that makes it seem easy, and understandable. might give it a go replacing the wildcard with a single user to test.

        dafyre 1 Reply Last reply Reply Quote 0
        • dafyre
          dafyre @gjacobse last edited by

          @gjacobse said in Server 2012 PS: Script to update script path:

          breaking it down like that makes it seem easy, and understandable. might give it a go replacing the wildcard with a single user to test.

          I would recommend this, lol.

          gjacobse 1 Reply Last reply Reply Quote 1
          • gjacobse
            gjacobse @dafyre last edited by

            @dafyre said in Server 2012 PS: Script to update script path:

            @gjacobse said in Server 2012 PS: Script to update script path:

            breaking it down like that makes it seem easy, and understandable. might give it a go replacing the wildcard with a single user to test.

            I would recommend this, lol.

            Oh - I would too... 🙂

            1 Reply Last reply Reply Quote 0
            • gjacobse
              gjacobse last edited by

              Since I was working with only ONE user this is what I needed to change it to, else was getting Parameter set cannot be resolved

              Import-module ActiveDirectory  
              Get-ADUser -Filter {Name -eq "SomeUser"} -SearchBase "OU=Users,OU=OUGroup,DC=DOMAINname,DC=com" | Set-ADUser –scriptPath “\\SERVERNAME\netlogon\2018ADUC-script.txt”
              

              But it worked!

              1 Reply Last reply Reply Quote 2
              • First post
                Last post