Add nodes

Nodes are added to the management by running a PowerShell script on the node.

When you create a Group you can download a registration script that adds a node directly to this specific group.

As a best practice, create an unassigned group, register the nodes to this group and then move the nodes to the desired group afterward. Your workspace should already consist of a XOAP unassigned group that you can use for this purpose.

download-script.png

A ps1 file will be downloaded with the name of the group:

e.g. register_XOAP_unassigned.ps1

Set your execution policy to bypass on your nodes and run the script to register the node to the backend.

The script will also install the XOAP DSC module and configure the local LCM.


#Requires -RunAsAdministrator
[DscLocalConfigurationManager()]
Configuration LCMDefault
{

        $regKey 		= '3e0cbed0-0b21-4e8e-874e-7577f9cda75f'
        Settings
        {
            RefreshFrequencyMins            = 180;
            RefreshMode                     = 'PULL';
            ConfigurationMode               = 'ApplyAndAutoCorrect';
            AllowModuleOverwrite            = $true;
            RebootNodeIfNeeded              = $false;
            ConfigurationModeFrequencyMins  = 30;
            
        }
        ConfigurationRepositoryWeb 'infra XO'
        {
            ServerURL         			    = 'https://configuration-management.api.xoap.io/dsc/01840652-aed8-4843-82eb-76395ff98322'
            RegistrationKey                 = $regKey
            ConfigurationNames              = 'GRP#08dd8fc0-502d-4ba8-93db-075a2e169779'
            AllowUnsecureConnection			= $true

        }
        ReportServerWeb 'infra XO'
        {
            ServerURL = 'https://configuration-management.api.xoap.io/dsc/01840652-aed8-4843-82eb-76395ff98322'
            RegistrationKey   = $regKey
            AllowUnsecureConnection = $true
        }   
}
if ($PSISE -ne $null -or (![Environment]::Is64BitProcess)){
    Write-Error 'This Script must not be run in the ISE and a PowerShell x86! Please use a normal PowerShell x64'
    exit 1
}
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v2.0.50727' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

winrm quickconfig -quiet
Enable-PSRemoting -Force -SkipNetworkProfileCheck
Set-Item -Path WSMan:\localhost\MaxEnvelopeSizeKb -Value 16384
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 4096

Write-Warning 'Restarting WinRM'
Restart-Service WinRM -Force

LCMDefault
Set-DSCLocalConfigurationManager  -Path .\LCMDefault\ -Verbose 
Update-DscConfiguration -Verbose -Wait

The group id and the registration id differs from group to group. The script will be generated with the correct values for your Workspace.

Register nodes via commandline

You can directly register nodes on the commandline. This is also the easiest way for a mass registration of nodes. Open a PowerShell as administrator and run the following command:

Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://api.dev.xoap.io/dsc/Policy/YOURWORKSPACEID/Download/YOURGROUPNAME'))

You can find your workspace ID on the main dashboard or in the URL of your browser. The group name is the group name you specified in Configuration Management > Groups