Display: Cloud | List
Most Popular Tags
Creating groups with Powershell (GroupPrincipal Constructor (PrincipalContext, String) (System.DirectoryServices.AccountManagement))
#requires -Version 2.0 ## add the assembly Add-Type -AssemblyName System.DirectoryServices.AccountManagement ## create the context i.e. connect to the domain $ctype = [System.DirectoryServices.AccountManagement.ContextType]::Doma$context = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList $ctype, "manticore.org", "OU=AMTest,DC=Manticore,DC=org" #
Last modified by Thomas Lee on 8/2/2010 11:48:51 AM
Using PowerShell (UserPrincipal Constructor (PrincipalContext) (System.DirectoryServices.AccountManagement))
This is very useful functionality to access via PowerShell. It makes user creation via scripts very much easier the system.directoryservices.directoryentry. This example was created on a Windows Server 2008 domain controller using PowerShell V2 CTP 2 Before we can do anything we need to create a user account. If you are doing this on a Vista or Windows Server 2008 with UAC enabled then you need t
Last modified by Thomas Lee on 8/2/2010 11:48:26 AM
Creating a local user (UserPrincipal Constructor (PrincipalContext) (System.DirectoryServices.AccountManagement))
Creating a local user is similar to creating a domain user I showed above #requires -Version 2.0## add the assemblyAdd-Type -AssemblyName System.DirectoryServices.AccountManagement ## create a password$password = Read-Host "Password" -AsSecureString ## create the context i.e. connect to the domain$ctype = [System.DirectoryServices.AccountManagement.ContextType]::Machine$context = New-Object -
Last modified by Thomas Lee on 8/2/2010 11:47:13 AM
Page view tracker