I am trying to add computer to the AD groups but The power shell code not running
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
I am trying to add computer to the AD groups
code:
Import-Module ActiveDirectory -WarningAction SilentlyContinue
$username = $userName -replace "%27","'";
$groups = @()
$groups = $groupNames -replace ' "','' -replace '"','' -replace ' ]','' -replace '\[','' -replace '%27','''' -split ","
try
{
$result = Add-ADPrincipalGroupMembership -Identity $username -MemberOf $groups -Credential $cred -Server $computer
$status = "Success"
}
catch
{
$result = $_.Exception.Message
$status = "Error"
}
$response = @{
status = $status
body = $result
} | convertTo-Json
Write-Output $response
error : the action not run it is in inprogress
I am assuming the after mid server restart...the flow is not running.. how to fix this
