remove computer from group in flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 07:46 AM
i need to remove a computer from AD via flow designer. I need help creating and action and I try creating a similar action to the remove user but got a powershell error
action created was
import-module "$executingScriptDirectory\ADSpoke\ActiveDirectoryMain"
if (test-path env:\SNC_groupname) {
$groupname = $env:SNC_groupname;
$username = $env:SNC_username;
};
$groupname = $groupname -replace "%27","'";
$username = $username -replace "%27","'";
removeADComputerFromGroup -domainController $computer -username $username -groupname $groupname -useCred $useCred -credential $cred
from active directorymain
###################################
# Remove Computer from Group
# Custom Function
###################################>
function removeComputerFromGroup {
param([string]$domainController, [string]$username, [string]$groupname, [boolean]$useCred, [System.Management.Automation.PSCredential]$credential)
SNCLog-ParameterInfo @("Running removeADUserAccountFromGroup", $domainController, $username, $groupname)
$userObject = getADObject -domainController $domainController -type "Computer" -objectName $username -useCred $useCred -credential $credential
$groupObject = getADObject -domainController $domainController -type "Group" -objectName $groupname -useCred $useCred -credential $credential
$groupObject.remove("LDAP://"+$userObject.distinguishedName);
if (-not $?) {
SNCLog-DebugInfo "`tFailed to remove $username computer from $groupname group, $error"
}
}
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 07:57 AM
Need a bit more information.
1. Why did you not use the ServiceNow pre-built Flow actions for MSAD?
2. What specific error did you receive?
Aoife
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 09:03 AM
remove computer is not an action on the prebuilt flow actions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 11:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2022 11:10 PM
i need to remove it from an AD group not from AD.