Currently this is a script I’ve been working on but trying to finish it hopefully someone can give me an answer on Moving a customers home folder within the Profile tab to a archive destination, as well remove all security groups except for Domain Users & WERW Users. Please anyone help!! <\/p>\n
#Imports<\/span> Module #Targets<\/span> Specific OU #Imports<\/span> the CSV #Disables<\/span> the Account #Remove<\/span> Security Groups #Sets<\/span> Description #Move<\/span> Homeshare to archived destination<\/p>\n #Moves<\/span> the Account to InTransit Start-Sleep -s 20 Currently this is a script I’ve been working on but trying to finish it hopefully someone can give me an answer on Moving a customers home folder within the Profile tab to a archive destination, as well remove all security groups except for Domain Users & WERW Users. Please anyone help!! #Imports<\/span> Module #Targets<\/span> Specific OU #Imports<\/span> the CSV #Disables<\/span> the Account #Remove<\/span> Security Groups #Sets<\/span> Description #Move<\/span> Homeshare to archived destination<\/p>\n #Moves<\/span> the Account to InTransit Start-Sleep -s 20 So, what is not working in your script? Do you get an error? Where are you stuck?<\/p>\n If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n
\nImport-Module Activedirectory<\/p>\n
\n$targetou=‘OU=xxxxx,OU=fsfgsgsgs,OU=cccccc,OU=ewewrw,OU=ewrwrwtt,DC=ddd,DC=www,DC=eeqq,DC=twtwt’<\/p>\n
\n$UserList = Import-Csv “C:\\Users\\xcxcxcxc\\Desktop\\op.txt”
\nforeach ($User in $UserList) {
\n$u = $User.sAMAccountName
\n$u
\n$ADUser = Get-ADUser -Filter { sAMAccountName -eq $u } | Select -ExpandProperty DistinguishedName<\/p>\n
\nSet-ADUser -Identity $User.sAMAccountName -Enabled $false<\/p>\n
\nGet-AdPrincipalGroupMembership -Identity $User.sAMAccountName| Where-Object -Property Name -Ne -Value ‘Domain Users’| Remove-AdGroupMember -Members $User.sAMAccountName<\/p>\n
\nSet-ADUser -Identity $User.sAMAccountName -Description \"Outprocessed<\/p>\n
\nMove-ADObject -Identity $ADUser -TargetPath $TargetOU<\/p>\n<\/a>Pause: Pause 20 seconds for Active Directory to replicate changes<\/h1>\n
\n}<\/p>","upvoteCount":1,"answerCount":23,"datePublished":"2019-07-15T13:30:31.000Z","author":{"@type":"Person","name":"hyd3official","url":"https://community.spiceworks.com/u/hyd3official"},"suggestedAnswer":[{"@type":"Answer","text":"<\/p>\n
\nImport-Module Activedirectory<\/p>\n
\n$targetou=‘OU=xxxxx,OU=fsfgsgsgs,OU=cccccc,OU=ewewrw,OU=ewrwrwtt,DC=ddd,DC=www,DC=eeqq,DC=twtwt’<\/p>\n
\n$UserList = Import-Csv “C:\\Users\\xcxcxcxc\\Desktop\\op.txt”
\nforeach ($User in $UserList) {
\n$u = $User.sAMAccountName
\n$u
\n$ADUser = Get-ADUser -Filter { sAMAccountName -eq $u } | Select -ExpandProperty DistinguishedName<\/p>\n
\nSet-ADUser -Identity $User.sAMAccountName -Enabled $false<\/p>\n
\nGet-AdPrincipalGroupMembership -Identity $User.sAMAccountName| Where-Object -Property Name -Ne -Value ‘Domain Users’| Remove-AdGroupMember -Members $User.sAMAccountName<\/p>\n
\nSet-ADUser -Identity $User.sAMAccountName -Description \"Outprocessed<\/p>\n
\nMove-ADObject -Identity $ADUser -TargetPath $TargetOU<\/p>\n<\/a>Pause: Pause 20 seconds for Active Directory to replicate changes<\/h1>\n
\n}<\/p>","upvoteCount":1,"datePublished":"2019-07-15T13:30:31.000Z","url":"https://community.spiceworks.com/t/outprocessing-customers/720860/1","author":{"@type":"Person","name":"hyd3official","url":"https://community.spiceworks.com/u/hyd3official"}},{"@type":"Answer","text":"