ActiveDirectoryManagement.ps1

A group of functions that can be used together to work with an Active Directory domain.

 
 
 
 
 
4.8 Star
(8)
4,883 times
Add to favorites
Active Directory
2/14/2012
E-mail Twitter del.icio.us Digg Facebook
  • New to Powershell
    1 Posts | Last post April 27, 2017
    • Hello Jeff.  First off thanks for these scripts, they will really help.  I tried to use this script along with the reboot-computer script that calls upon this one.   It looks like in your reboot-computer script you only need to change the OU info for my company and the location where this activedirectory... ps1 script is located.  If I'm right, I run the remote-computer script as admin but it doesn't seem to find any computers in active directory.  No matter what OU I specify it returns with 0 computers found.  Am I missing something?
  • what does it do?
    2 Posts | Last post July 13, 2016
    • Hello Jeffrey, the discription says "A group of functions". Could you be a bit more specifice? tnx
    • I can I suppose, although there is a fair amount of what it does in the description of the script. Basically I'm using the .net libraries to build my own AD cmdlets. At the time I was working someplace where what we were allowed to add to the systems was very very tightly controlled. So I would load these up manually in order to do my job. If you have specific questions about something, please let me know.
      
      Also, the cmdlets themselves should be very well documented
  • Recent Changes
    4 Posts | Last post January 03, 2012
    • I have added two new functions since the last update of this code. Please visit http://scripts.patton-tech.com/browser/powershell/production/includes/ActiveDirectoryManagement.ps1 to view previous revisions.
    • Two more functions added today, a function to reset a computer account, and a function to add a domain security group to a local computer group. Please visit http://scripts.patton-tech.com/wiki/PowerShell/ActiveDirectoryManagement.ps1 for more details.
    • Added several new functions and bug fixes, I've not created the links yet, so there will be a second update soon.
    • This is a bugfix, the Get-LocalGroupMembers function was outputting the $group as part of the process, which was littering up the buffer. When used in a subsquent script piping that result through format-table rendered null data.
  • $objSearcher.PropertiesToLoad.Add($i)
    3 Posts | Last post March 16, 2011
    • If someone can point me in the right place to fix this I would really appreciate it. Currently if you run this function from the shell, you will see the following output:
      
      PS C:\Users\jspatton\My Repositories\scripts\powershell\production> $computers = Get-ADObjects
      
      cmdlet Get-ADObjects at command pipeline position 1
      Supply values for the following parameters:
      objOU: LDAP://OU=School of Engineering,DC=home,DC=ku,DC=edu
      PS C:\Users\jspatton\My Repositories\scripts\powershell\production> $computers
      0
      
      Path
      ----
      LDAP://CN=engr-client-7,OU=MFD,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=engr-ftp,OU=Servers,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=engr-lts,OU=Servers,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=engr-ltsp,OU=Servers,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=engr-sftp,OU=Servers,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=l1132a-lt01,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=l3117-vm02,OU=3117,OU=Learned,OU=Research,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=l3117-vm03,OU=3117,OU=Learned,OU=Research,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=l3117-vm04,OU=3117,OU=Learned,OU=Research,OU=School of Engineering,DC=home,DC=ku,DC=edu
      LDAP://CN=l3117-vm01,OU=3117,OU=Learned,OU=Research,OU=School of Engineering,DC=home,DC=ku,DC=edu
      
      You will note the lone 0 at the beginning of the output, when I comment out the $objSearcher line it goes away. Someone suggested that one way to solve this would be to add a sort option, but sort wants a single property to sort on, and I potentially may have multiple properties that I would like to load.
      
      It's also possible that I'm going about this the wrong way. The idea of the foreach loop is to load up only the properties I'm interested in, which should increase the speed of the function with large numbers of objects.
      
      Any help would be greatly appreciated.
    • Replace $objSearcher.PropertiesToLoad.Add($i) with [void]$objSearcher.PropertiesToLoad.Add($i) and that 0 will go away.
    • Thank you so much Boe! Truly appreciated!