ML
    • Register
    • Login
    • Search
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. Tags
    3. ps
    Log in to post
    • All categories
    • wrx7m

      Any Way to Automate Adding a New Computer to an AD Group?
      IT Discussion • windows 10 windows server ad active directory gpo mdt powershell ps pdq deploy ou task sequence • • wrx7m

      32
      0
      Votes
      32
      Posts
      3974
      Views

      F

      @marcinozga said in Any Way to Automate Adding a New Computer to an AD Group?:

      @flaxking said in Any Way to Automate Adding a New Computer to an AD Group?:

      @marcinozga said in Any Way to Automate Adding a New Computer to an AD Group?:

      Ansible can do that. https://docs.ansible.com/ansible/latest/modules/win_domain_group_membership_module.html#win-domain-group-membership-module
      You can add new PCs to domain, and change their group membership, you just need to know computer names in advance.

      Which is just a layer on top of Powershell. The Active Directory Powershell module is still required.

      It's not required, or that module is included already in Windows 10 by default. Because I haven't had to install it on any machine I managed with Ansible.

      "win_domain_group_membership requires the ActiveDirectory PS module to be installed"
      https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/windows/win_domain_group_membership.ps1

      They have it in the documentation as well "This must be run on a host that has the ActiveDirectory powershell module installed."
      https://docs.ansible.com/ansible/latest/modules/win_domain_group_module.html

    • RojoLoco

      Solved Use Powershell to audit Windows service accounts
      IT Discussion • ps powershell scripting windows • • RojoLoco

      6
      3
      Votes
      6
      Posts
      943
      Views

      RojoLoco

      @Kelly said in Use Powershell to audit Windows service accounts:

      Unless you're wanting to use Powershell for a learning experience you might look at something like this: http://www.cjwdev.com/Software/ServiceCredMan/Info.html. If you still want to use the Powershell route this might be a good way to check the success of your script.

      That looks like it will do exactly what we want... thanks for the link.

    • gjacobse

      PowerShell: Public Folder Search / remove
      IT Discussion • ps powershell office365 office 365 distro distribution groups addremove • • gjacobse

      3
      0
      Votes
      3
      Posts
      445
      Views

      black3dynamite

      @gjacobse said in PowerShell: Public Folder Search / remove:

      Is this what I am looking for?

      Remove-PublicFolderClientPermission -Identity "\My Public Folder" -User Contoso\Chris

      Looks correct to me.

    • gjacobse

      Powershell: Use PS to email results
      IT Discussion • ps powershell o365 sendmail • • gjacobse

      14
      1
      Votes
      14
      Posts
      1073
      Views

      nadnerB

      I can't remember where is nabbed it from, but I use the following:

      Function Mailer { $emailTo = "" $emailFrom = "" $subject="It's broken, damn it" $smtpserver="" $smtp=new-object System.Net.Mail.SmtpClient($smtpServer) $Message = @" Insert a useful/meaningful message here. "@ } Mailer

      Last line calls the function (duh for you, but a visitor here might not know).

    • gjacobse

      Understand CMD CLI to Powershell Variable
      IT Discussion • cmd cmdlet ps powershell chocolatey batch script scripting • • gjacobse

      2
      0
      Votes
      2
      Posts
      720
      Views

      dbeato

      @gjacobse So basically you want to iterate through a list of computers the same script correct? So do you have a list of computers? What are other steps on your script? because what we can do is the following

      *$computers = import-csv -Path "c:\script\computers.csv" foreach ($oldname in $computers){ Rename-Computer -NewName $newname -DomainCredential domain\admin -Restart}

      This assumes you have a CSV file with a oldname and new name columns with computer names.