Add Computer to Group(On-Prem) - Custom Action

Modified on Wed, 24 Aug 2022 at 05:01 AM

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"
}



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article