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

      Any Way to Automate Adding a New Computer to an AD Group?

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion windows 10 windows server ad active directory gpo mdt powershell ps pdq deploy ou task sequence
      32
      0 Votes
      32 Posts
      9k 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

    • RojoLocoR

      Use Powershell to audit Windows service accounts

      Watching Ignoring Scheduled Pinned Locked Moved Solved IT Discussion ps powershell scripting windows
      6
      3 Votes
      6 Posts
      1k Views
      RojoLocoR

      @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.

    • gjacobseG

      PowerShell: Public Folder Search / remove

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion ps powershell office365 office 365 distro distribution groups addremove
      3
      0 Votes
      3 Posts
      769 Views
      black3dynamiteB

      @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.

    • gjacobseG

      Powershell: Use PS to email results

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion ps powershell o365 sendmail
      14
      1 Votes
      14 Posts
      2k Views
      nadnerBN

      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).

    • gjacobseG

      Understand CMD CLI to Powershell Variable

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion cmd cmdlet ps powershell chocolatey batch script scripting
      2
      0 Votes
      2 Posts
      1k Views
      dbeatoD

      @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.

    • 1 / 1