offboarding = someone leaving
onboarding = someone joining
The reason for the sleep command is that it was having issues running everything correctly. I started with the pipe but it wasn't working correctly. Sometimes it would do it and others it would skip over it. When started again from scratch, i built it one task at a time. So when as i was testing i entered in the sleep commands and it started to work.
I have it working if i want to do one user at a time, I don't want to do that at this time, i want to be able to use a csv import to do all the same things. But for some reason it is not working.
So what would normally happen is that the user(being disabled) would remove its export its all member of groups, then remove that user from all those groups. (it works when I use the single target offboard script)
I tried to use the ' get-content' then started by commmenting out all the tasks, leaving only the disable. It worked, then commented in the move to another OU, it worked. I commented in to add date to webpage(homepage) and it worked, just anything after that it would stop working. Looks like it is having issues with 'identity'
Code: Select all
[Codebox=text file=Untitled.txt]ERROR: Disable-ADAccount : Cannot convert 'Microsoft.ActiveDirectory.Management.ADPropertyValueCollection' to the type
ERROR: 'Microsoft.ActiveDirectory.Management.ADAccount' required by parameter 'Identity'. Specified method is not supported.
ERROR: At E:\scripts\UpdateADUsers\bulk_off_board_test4.ps1:29 char:31
ERROR: + Disable-ADAccount -Identity $Username
ERROR: + ~~~~~~~~~
ERROR: + CategoryInfo : InvalidArgument: (:) [Disable-ADAccount], ParameterBindingException
ERROR: + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.DisableADAccount
ERROR:
ERROR: Remove-ADGroupMember : The specified account name is not a member of the group
ERROR: At E:\scripts\UpdateADUsers\bulk_off_board_test4.ps1:27 char:15
ERROR: + $Username | Remove-ADGroupMember -Members $username -Confirm:$false
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : NotSpecified: (CN=HDQ Door 9,O...,DC=local:ADGroup) [Remove-ADGroupMember], ADException
ERROR: + FullyQualifiedErrorId : ActiveDirectoryServer:1377,Microsoft.ActiveDirectory.Management.Commands.RemoveADGroupMember
ERROR:
ERROR: Set-ADUser : Cannot convert 'Microsoft.ActiveDirectory.Management.ADPropertyValueCollection' to the type 'Microsoft.ActiveDirectory.Management.ADUser'
ERROR: required by parameter 'Identity'. Specified method is not supported.
ERROR: At E:\scripts\UpdateADUsers\bulk_off_board_test4.ps1:32 char:14
ERROR: + Set-ADUser $username -HomePage $now
ERROR: + ~~~~~~~~~
ERROR: + CategoryInfo : InvalidArgument: (:) [Set-ADUser], ParameterBindingException
ERROR: + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.SetADUser
ERROR:
ERROR: Get-ADUser : Cannot convert 'Microsoft.ActiveDirectory.Management.ADPropertyValueCollection' to the type 'Microsoft.ActiveDirectory.Management.ADUser'
ERROR: required by parameter 'Identity'. Specified method is not supported.
ERROR: At E:\scripts\UpdateADUsers\bulk_off_board_test4.ps1:34 char:14
ERROR: + Get-ADUser $username | Move-ADObject -TargetPath 'OU=Terminated Use ...
ERROR: + ~~~~~~~~~
ERROR: + CategoryInfo : InvalidArgument: (:) [Get-ADUser], ParameterBindingException
ERROR: + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.GetADUser[/Codebox]