On-Premise: Add computer to group - Custom action

  • Last update on January 25th, 2024

Table of Contents

Please note that, if you have a Professional or Enterprise package, you must purchase the Hybrid add-on to create this custom action.

 

If you are looking for a way to add a computer to an on-premise group you can use the following script:

In Powershell:

param ([string]$Group, [string]$Computer)
$Comp = Get-ADComputer -Identity "$Computer"
ADD-ADGroupMember -identity $Group –members $Comp

If you want to use this within CoreView as a Custom Action, you can import following script:

{
 "id": "21ba9856-5928-4d09-ad02-c8f2bd08f90e",
 "title": "Add Computer to Group",
 "description": "Add this computer to a Group",
 "lastModified": "2022-08-19T14:35:36.4460000Z",
 "target": "None",
 "tags": [],
 "vars": [
 {
 "name": "Group",
 "type": "string",
 "isRequired": true
 },
 {
 "name": "Computer",
 "type": "string",
 "isRequired": true
 }
 ],
 "params": [],
 "columns": {},
 "version": 4,
 "statement": "param ([string]$Group, [string]$Computer)\r\n\r\n$Comp = Get-ADComputer -Identity \"$Computer\" | Select-Object DistinguishedName\nADD-ADGroupMember -identity $Group –members $Comp.DistinguishedName"
}