Synopsis
Description
The Identity parameter specifies the Active Directory user to modify. You can identify a user by its distinguished name (DN), GUID, security identifier (SID) or Security Accounts Manager (SAM) account name. You can also set the Identity parameter to an object variable such as $, or you can pass an object through the pipeline to the Identity parameter. For example, you can use the Get-ADUser cmdlet to retrieve a user object and then pass the object through the pipeline to the Set-ADUser cmdlet.
The Instance parameter provides a way to update a user object by applying the changes made to a copy of the object. When you set the Instance parameter to a copy of an Active Directory user object that has been modified, the Set-ADUser cmdlet makes the same changes to the original user object. To get a copy of the object to modify, use the Get-ADUser object. The Identity parameter is not allowed when you use the Instance parameter. For more information about the Instance parameter, see the Instance parameter description. For more information about how the Instance concept is used in Active Directory cmdlets, see about_ActiveDirectory_Instance.
Accounts created with the New-ADUser cmdlet will be disabled if no password is provided.
-By specifying the Identity and the Manager parameters
-By passing a user object through the pipeline and specifying the Manager parameter
-By specifying the Instance parameter.
Method 1: Modify the Manager property for the “RaviS” user by using the Identity and Manager parameters.
Set-ADUser -Identity “RaviS” -Manager “KarthikS”
Method 2: Modify the Manager property for the “RaviS” user by passing the “RaviS” user through the pipeline and specifying the Manager parameter.
Get-ADUser -Identity “RaviS” | Set-ADUser -Manager “KarthikS”
Method 3: Modify the Manager property for the “RaviS” user by using the Windows PowerShell command line to modify a local instance of the “RaviS” user. Then set the Instance parameter to the local instance.
$user = Get-ADUser -Identity “RaviS”
$user.Manager = “KarthikS”
Set-ADUser -Instance $user.
-The cmdlet is run from an Active Directory provider drive.
-A default naming context or partition is defined for the AD LDS environment. To specify a default naming context for an AD LDS environment, set the msDS-defaultNamingContext property of the Active Directory directory service agent (DSA) object (nTDSDSA) for the AD LDS instance.
Parameters
-AccountExpirationDate
Specifies the expiration date for an account. When you set this parameter to 0, the account never expires. This parameter sets the AccountExpirationDate property of an account object. The LDAP Display name (ldapDisplayName) for this property is accountExpires.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-AccountNotDelegated <Boolean>
Specifies whether the security context of the user is delegated to a service. When this parameter is set to true, the security context of the account is not delegated to a service even when the service account is set as trusted for Kerberos delegation. This parameter sets the AccountNotDelegated property for an Active Directory account. This parameter also sets the ADS_UF_NOT_DELEGATED flag of the Active Directory User Account Control (UAC) attribute. Possible values for this parameter include
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Add <Hashtable>
Specifies values to add to an object property. Use this parameter to add one or more values to a property that cannot be modified using a cmdlet parameter. To modify an object property, you must use the LDAP display name. You can specify multiple values to a property by specifying a comma-separated list of values and more than one property by separating them using a semicolon.. The format for this parameter is
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-AllowReversiblePasswordEncryption <Boolean>
Specifies whether reversible password encryption is allowed for the account. This parameter sets the AllowReversiblePasswordEncryption property of the account. This parameter also sets the ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED flag of the Active Directory User Account Control (UAC) attribute. Possible values for this parameter include:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-AuthenticationPolicy <ADAuthenticationPolicy>
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-AuthenticationPolicySilo <ADAuthenticationPolicySilo>
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-AuthType <ADAuthType>
Specifies the authentication method to use. Possible values for this parameter include:
Required? false
Position? named
Default value Microsoft.ActiveDirectory.Management.AuthType.Negotiate
Accept pipeline input? false
Accept wildcard characters? false
-CannotChangePassword <Boolean>
Specifies whether the account password can be changed. This parameter sets the CannotChangePassword property of an account. Possible values for this parameter include:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Certificates <Hashtable>
Modifies the DER-encoded X.509v3 certificates of the account. These certificates include the public key certificates issued to this account by the Microsoft Certificate Service. This parameter sets the Certificates property of the account object. The LDAP Display Name (ldapDisplayName) for this property is "userCertificate".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ChangePasswordAtLogon <Boolean>
Specifies whether a password must be changed during the next logon attempt. Possible values for this parameter include:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-City <String>
Specifies the user's town or city. This parameter sets the City property of a user. The LDAP display name (ldapDisplayName) of this property is "l".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Clear <String[]>
Specifies an array of object properties that will be cleared in the directory. Use this parameter to clear one or more values of a property that cannot be modified using a cmdlet parameter. To modify an object property, you must use the LDAP display name. You can modify more than one property by specifying a comma-separated list. The format for this parameter is
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Company <String>
Specifies the user's company. This parameter sets the Company property of a user object. The LDAP display name (ldapDisplayName) of this property is "company".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CompoundIdentitySupported <Boolean>
Specifies whether an account supports Kerberos service tickets which includes the authorization data for the user's device. This value sets the compound identity supported flag of the Active Directory msDS-SupportedEncryptionTypes attribute. Possible values for this parameter are:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Country <String>
Specifies the country or region code for the user's language of choice. This parameter sets the Country property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "c". This value is not used by Windows 2000.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Credential <PSCredential>
Specifies the user account credentials to use to perform this task. The default credentials are the credentials of the currently logged on user unless the cmdlet is run from an Active Directory PowerShell provider drive. If the cmdlet is run from such a provider drive, the account associated with the drive is the default.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Department <String>
Specifies the user's department. This parameter sets the Department property of a user. The LDAP Display Name (ldapDisplayName) of this property is "department".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Description <String>
Specifies a description of the object. This parameter sets the value of the Description property for the object. The LDAP Display Name (ldapDisplayName) for this property is "description".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DisplayName <String>
Specifies the display name of the object. This parameter sets the DisplayName property of the object. The LDAP Display Name (ldapDisplayName) for this property is "displayName".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Division <String>
Specifies the user's division. This parameter sets the Division property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "division".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-EmailAddress <String>
Specifies the user's e-mail address. This parameter sets the EmailAddress property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "mail".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-EmployeeID <String>
Specifies the user's employee ID. This parameter sets the EmployeeID property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "employeeID".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-EmployeeNumber <String>
Specifies the user's employee number. This parameter sets the EmployeeNumber property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "employeeNumber".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Enabled <Boolean>
Specifies if an account is enabled. An enabled account requires a password. This parameter sets the Enabled property for an account object. This parameter also sets the ADS_UF_ACCOUNTDISABLE flag of the Active Directory User Account Control (UAC) attribute. Possible values for this parameter include:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Fax <String>
Specifies the user's fax phone number. This parameter sets the Fax property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "facsimileTelephoneNumber".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-GivenName <String>
Specifies the user's given name. This parameter sets the GivenName property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "givenName".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-HomeDirectory <String>
Specifies a user's home directory. This parameter sets the HomeDirectory property of a user object. The LDAP Display Name (ldapDisplayName) for this property is "homeDirectory".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-HomeDrive <String>
Specifies a drive that is associated with the UNC path defined by the HomeDirectory property. The drive letter is specified as "<DriveLetter>:" where <DriveLetter> indicates the letter of the drive to associate. The <DriveLetter> must be a single, uppercase letter and the colon is required. This parameter sets the HomeDrive property of the user object. The LDAP Display Name (ldapDisplayName) for this property is "homeDrive".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-HomePage <String>
Specifies the URL of the home page of the object. This parameter sets the homePage property of an Active Directory object. The LDAP Display Name (ldapDisplayName) for this property is "wWWHomePage".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-HomePhone <String>
Specifies the user's home telephone number. This parameter sets the HomePhone property of a user. The LDAP Display Name (ldapDisplayName) of this property is "homePhone".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Identity <ADUser>
Specifies an Active Directory user object by providing one of the following property values. The identifier in parentheses is the LDAP display name for the attribute.
Required? true
Position? 1
Default value
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-Initials <String>
Specifies the initials that represent part of a user's name. You can use this value for the user's middle initial. This parameter sets the Initials property of a user. The LDAP Display Name (ldapDisplayName) of this property is "initials".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Instance <ADUser>
Specifies an ADUser object that identifies the Active Directory user object that should be modified and the set of changes that should be made to that object. When this parameter is used, any modifications made to the ADUser object are also made to the corresponding Active Directory object. The cmdlet only updates the object properties that have changed.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-KerberosEncryptionType <ADKerberosEncryptionType>
Specifies whether an account supports Kerberos encryption types which are used during creation of service tickets. This value sets the encryption types supported flags of the Active Directory msDS-SupportedEncryptionTypes attribute. Possible values for this parameter are:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LogonWorkstations <String>
Specifies the computers that the user can access. To specify more than one computer, create a single comma-separated list. You can identify a computer by using the Security Accounts Manager (SAM) account name (sAMAccountName) or the DNS host name of the computer. The SAM account name is the same as the NetBIOS name of the computer.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Manager <ADUser>
Specifies the user's manager. This parameter sets the Manager property of a user. This parameter is set by providing one of the following property values. Note: The identifier in parentheses is the LDAP display name for the property.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-MobilePhone <String>
Specifies the user's mobile phone number. This parameter sets the MobilePhone property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "mobile".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Office <String>
Specifies the location of the user's office or place of business. This parameter sets the Office property of a user object. The LDAP display name (ldapDisplayName) of this property is "office".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-OfficePhone <String>
Specifies the user's office telephone number. This parameter sets the OfficePhone property of a user object. The LDAP display name (ldapDisplayName) of this property is "telephoneNumber".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Organization <String>
Specifies the user's organization. This parameter sets the Organization property of a user object. The LDAP display name (ldapDisplayName) of this property is "o".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-OtherName <String>
Specifies a name in addition to a user's given name and surname, such as the user's middle name. This parameter sets the OtherName property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "middleName".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-POBox <String>
Specifies the user's post office box number. This parameter sets the POBox property of a user object. The LDAP Display Name (ldapDisplayName) of this property is "postOfficeBox".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Partition <String>
Specifies the distinguished name of an Active Directory partition. The distinguished name must be one of the naming contexts on the current directory server. The cmdlet searches this partition to find the object defined by the Identity parameter.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-PassThru <SwitchParameter>
Returns the new or modified object. By default (i.e. if -PassThru is not specified), this cmdlet does not generate any output.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-PasswordNeverExpires <Boolean>
Specifies whether the password of an account can expire. This parameter sets the PasswordNeverExpires property of an account object. This parameter also sets the ADS_UF_DONT_EXPIRE_PASSWD flag of the Active Directory User Account Control attribute. Possible values for this parameter include:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-PasswordNotRequired <Boolean>
Specifies whether the account requires a password. This parameter sets the PasswordNotRequired property of an account, such as a user or computer account. This parameter also sets the ADS_UF_PASSWD_NOTREQD flag of the Active Directory User Account Control attribute. Possible values for this parameter are:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-PostalCode <String>
Specifies the user's postal code or zip code. This parameter sets the PostalCode property of a user. The LDAP Display Name (ldapDisplayName) of this property is "postalCode".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-PrincipalsAllowedToDelegateToAccount <ADPrincipal[]>
This parameter sets the msDS-AllowedToActOnBehalfOfOtherIdentity attribute of a computer account object.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ProfilePath <String>
Specifies a path to the user's profile. This value can be a local absolute path or a Universal Naming Convention (UNC) path. This parameter sets the ProfilePath property of the user object. The LDAP display name (ldapDisplayName) for this property is "profilePath".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Remove <Hashtable>
Specifies that the cmdlet remove values of an object property. Use this parameter to remove one or more values of a property that cannot be modified using a cmdlet parameter. To remove an object property, you must use the LDAP display name. You can remove more than one property by specifying a semicolon-separated list. The format for this parameter is
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Replace <Hashtable>
Specifies values for an object property that will replace the current values. Use this parameter to replace one or more values of a property that cannot be modified using a cmdlet parameter. To modify an object property, you must use the LDAP display name. You can modify more than one property by specifying a comma-separated list. The format for this parameter is
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SamAccountName <String>
Specifies the Security Account Manager (SAM) account name of the user, group, computer, or service account. The maximum length of the description is 256 characters. To be compatible with older operating systems, create a SAM account name that is 20 characters or less. This parameter sets the SAMAccountName for an account object. The LDAP display name (ldapDisplayName) for this property is "sAMAccountName".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ScriptPath <String>
Specifies a path to the user's log on script. This value can be a local absolute path or a Universal Naming Convention (UNC) path. This parameter sets the ScriptPath property of the user. The LDAP display name (ldapDisplayName) for this property is "scriptPath".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Server <String>
Specifies the Active Directory Domain Services instance to connect to, by providing one of the following values for a corresponding domain name or directory server. The service may be any of the following: Active Directory Lightweight Domain Services, Active Directory Domain Services or Active Directory Snapshot instance.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ServicePrincipalNames <Hashtable>
Specifies the service principal names for the account. This parameter sets the ServicePrincipalNames property of the account. The LDAP display name (ldapDisplayName) for this property is servicePrincipalName. This parameter uses the following syntax to add remove, replace or clear service principal name values.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SmartcardLogonRequired <Boolean>
Specifies whether a smart card is required to logon. This parameter sets the SmartCardLoginRequired property for a user. This parameter also sets the ADS_UF_SMARTCARD_REQUIRED flag of the Active Directory User Account Control attribute. Possible values for this parameter are:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-State <String>
Specifies the user's or Organizational Unit's state or province. This parameter sets the State property of a User or Organizational Unit object. The LDAP display name (ldapDisplayName) of this property is "st".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-StreetAddress <String>
Specifies the user's street address. This parameter sets the StreetAddress property of a user object. The LDAP display name (ldapDisplayName) of this property is "streetAddress".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Surname <String>
Specifies the user's last name or surname. This parameter sets the Surname property of a user object. The LDAP display name (ldapDisplayName) of this property is "sn".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Title <String>
Specifies the user's title. This parameter sets the Title property of a user object. The LDAP display name (ldapDisplayName) of this property is "title".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-TrustedForDelegation <Boolean>
Specifies whether an account is trusted for Kerberos delegation. A service that runs under an account that is trusted for Kerberos delegation can assume the identity of a client requesting the service. This parameter sets the TrustedForDelegation property of an account object. This value also sets the ADS_UF_TRUSTED_FOR_DELEGATION flag of the Active Directory User Account Control attribute. Possible values for this parameter are:
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-UserPrincipalName <String>
Each user account has a user principal name (UPN) in the format <user>@<DNS-domain-name>. A UPN is a friendly name assigned by an administrator that is shorter than the LDAP distinguished name used by the system and easier to remember. The UPN is independent of the user object's DN, so a user object can be moved or renamed without affecting the user logon name. When logging on using a UPN, users no longer have to choose a domain from a list on the logon dialog box.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm <SwitchParameter>
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf <SwitchParameter>
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
Syntax
Set-ADUser [-WhatIf] [-Confirm] [-AccountExpirationDate <DateTime>] [-AccountNotDelegated <Boolean>] [-Add <Hashtable>] [-AllowReversiblePasswordEncryption <Boolean>] [-AuthenticationPolicy <ADAuthenticationPolicy>] [-AuthenticationPolicySilo <ADAuthenticationPolicySilo>] [-AuthType <ADAuthType>] [-CannotChangePassword <Boolean>] [-Certificates <Hashtable>] [-ChangePasswordAtLogon <Boolean>] [-City <String>] [-Clear <String[]>] [-Company <String>] [-CompoundIdentitySupported <Boolean>] [-Country <String>] [-Credential <PSCredential>] [-Department <String>] [-Description <String>] [-DisplayName <String>] [-Division <String>] [-EmailAddress <String>] [-EmployeeID <String>] [-EmployeeNumber <String>] [-Enabled <Boolean>] [-Fax <String>] [-GivenName <String>] [-HomeDirectory <String>] [-HomeDrive <String>] [-HomePage <String>] [-HomePhone <String>] [-Identity] <ADUser> [-Initials <String>] [-KerberosEncryptionType <ADKerberosEncryptionType>] [-LogonWorkstations <String>] [-Manager <ADUser>] [-MobilePhone <String>] [-Office <String>] [-OfficePhone <String>] [-Organization <String>] [-OtherName <String>] [-Partition <String>] [-PassThru] [-PasswordNeverExpires <Boolean>] [-PasswordNotRequired <Boolean>] [-POBox <String>] [-PostalCode <String>] [-PrincipalsAllowedToDelegateToAccount <ADPrincipal[]>] [-ProfilePath <String>] [-Remove <Hashtable>] [-Replace <Hashtable>] [-SamAccountName <String>] [-ScriptPath <String>] [-Server <String>] [-ServicePrincipalNames <Hashtable>] [-SmartcardLogonRequired <Boolean>] [-State <String>] [-StreetAddress <String>] [-Surname <String>] [-Title <String>] [-TrustedForDelegation <Boolean>] [-UserPrincipalName <String>] [<CommonParameters>]
Set-ADUser [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-Credential <PSCredential>] -Instance <ADUser> [-PassThru] [-SamAccountName <String>] [-Server <String>] [<CommonParameters>]
This cmdlet does not work with an Active Directory Snapshot.
C:\PS>Set-ADUser RameshS -HomePage ‘http://TOSSolution.com/employees/RameshS’ -LogonWorkstations ‘RameshS-DSKTOP,AntonioAl-LPTOP’
Set the user with samAccountName RameshS’s property homepage to http://TOSSolution.com/employees/RameshS and the LogonWorkstations property to RameshS-DSKTOP,RameshS-LPTOP.
C:\PS>Get-ADUser -Filter ‘Name -like “*”‘ -SearchBase ‘OU=hr,OU=UserAccounts,DC=TOSSolution,DC=COM’ -Properties DisplayName | % {Set-ADUser $_ -DisplayName ($_.Surname + ‘ ‘ + $_.GivenName)}
Get all the users in the directory that are located underneath the OU=hr,OU=UserAccounts,DC=TOSSolution,DC=COM organizationalUnit. Set the DisplayName property on these user objects to the concatentation of the Surname property and the GivenName property.
C:\PS>Set-ADUser GirishHG-Replace @{title=”director”;mail=”GirishHG@TOSSolution.com”}
Set the user with samAccountNAme GirishHG’s property title to director and property mail to GirishHG@TOSSolution.com.
C:\PS>Set-ADUser GirishHG -Remove @{otherMailbox=”Girish.HG”} -Add @{url=”TOSSolution.com”} -Replace @{title=”manager”} -Clear description
Modify the user with samAccountName GirishHG’s object by removing glen.john from the otherMailbox property, adding TOSSolution.com to the url property, replacing the title property with manager and clearing the description property.
C:\PS>$user = Get-ADUser GirishHG -Properties mail,department
$user.mail = “girish@TOSSolution.com”
$user.department = “Accounting”
Set-ADUser -instance $user
Set the mail and department properties on the user object with samAccountName GirishHG by using the instance parameter.
PS C:>$manager = Get-ADUser GirishHG -Server Dheli-DC01
PS C:>Set-ADUser KarthikS -Manager $manager -Server Bangalore-DC02
Set the Manager property for user with samAccountName of “KarthikS” where the manager (GirishHG) is a user in another domain.
Get-Command Set-ADUser
. Get-ADUser
. New-ADUser
. Remove-ADUser
. Set-ADAccountControl