Recently, I have received this error message while deleting a folder tree : The cause is a trailing space in the folder name. The only to delete this folder is to run this command : rd “\\?\G:\folder_with_a_trailing_space “ I have
Remove all group memberships from a user
This script can remove all group memberships from an Active Directory user, except the “Domain Users” group import-module activedirectory $DistinguishedName = “cn=youruseraccount,ou=users,dc=domain,dc=local” (Get-ADUser $DistinguishedName -Properties MemberOf | Select-Object MemberOf).MemberOf | % { Remove-ADGroupMember -Identity $_ -Members $DistinguishedName -confirm:$false } My
Set a random password to an Active Directory user
This script use the function GET-Temppassword to set a random password to a user account. You can customize this function with your own criteria import-module activedirectory Function GET-Temppassword() { $chars_min = [Char[]]”abcdefghijklmnopqrstuvwxyz” $chars_maj = [Char[]]”ABCDEFGHIJKLMNOPQRSTUVWXYZ” $chars_num = [Char[]]”0123456789″ $x_min =