PowerShell: Installare Domain Controller

Capita spesso di dover creare Macchine Virtuali simili tra loro. Studio o lavoro che sia, alcune attività sono ripetitive e, spesso, fanno perdere del tempo prezioso.
Ovviamente, quando è possibile, è meglio sfruttare le potenzialità messe a disposizione dagli strumenti di distribuzione, come ad esempio System Center.  Se non abbiamo a disposizione una struttura di distribuzione possiamo comunque utilizzare PowerShell per eseguire comandi ripetitivi e noiosi.

In questo breve articolo vedremo come distribuire un Domain Controller sia attraverso l’utilizzo dell’interfaccia grafica (GUI), sia attraverso PowerShell.
L’articolo non approfondisce l’utilizzo di PowerShell, ne vengono proposti soluzioni complesse. Lo scopo dell’articolo è quello di dare una base di partenza su cui elaborare ed implementare le proprie necessità secondo la propria filosofia lavorativa.

Descrizione infrastruttura
L’articolo si basa su un Server stand-alone in ambiente Microsoft Windows Server 2012 R2 Datacenter. Durante tutte le fasi sono stati utilizzati i valori di default proposti.

Nome Computer: DC-01
IPv4: 192.168.1.11
Subnet Mask: 255.255.255.0
Gateway: 192.168.1.1
DNS: 192.168.1.1

INSTALLAZIONE GUI
La prima cosa da fare è quella di installare il ruolo Active Directory Domain Services.

Successivamente effettueremo la creazione di un nuovo dominio all’interno di una nuova foresta ed il contestuale innalzamento del primo Domain Controller (dcpromo).

INSTALLAZIONE POWERSHELL
Adesso effettueremo le identiche attività svolte attraverso GUI basandoci su uno schema xml precedentemente salvato.
Quasi tutte le attività svolte attraverso l’interfaccia grafica permettono di generare il relativo comando PowerShell e schema di applicazione. Questo permette, in caso di necessità, di velocizzare le attività. Inoltre, con poco sforzo il codice è riutilizzabile in altri ambienti.

Ovviamente ripartiremo dallo stato di sistema iniziale (Workgroup). …quanto sono utili le snap 🙂

I files utilizzati per l’attività sono due:
– Active-Directory-Domain-Services.xml
– dcpromo-ps.ps1

Il primo file contiene tutto lo schema necessario per l’aggiunta del ruolo e delle relative Management.
Il secondo file, invece, è utilizzato per eseguire l’attività di creazione della foresta, del dominio e dell’innalzamento del server a Domain Controller (dcpromo).

Le attività vanno eseguite attraverso l’interfaccia PowerShell con credenziali elevate (Esegui come Administrator).
Per comodità ho copiato i due files nella root dell’utente Administrator

Il CMdLet da eseguire per aggiungere un nuovo ruolo/servizio è Install-WindowsFeature, indicando il file .xml da cui prendere le necessarie impostazioni.

Install-WindowsFeature -ConfigurationFilePath Active-Directory-Domain-Services.xml

La segnalazione ricevuta alla fine dell’esecuzione del CmdLet indica che non è possibile verificare la disponibilità di eventuali aggiornamenti del sistema in quanto la Macchina Virtuale è disconnessa dalla rete.

Passiamo quindi ad effettuare il dcpromo utilizzando il file .ps1 a cui passeremo due parametri. Il nome del dominio “testerlab.local” ed il nome NetBIOS “TESTERLAB”. Lasciamo gli altri valori di default (Database folder, Log files folder, SYSVOL folder).

.\dcpromo-ps.ps1 testerlab.local TESTERLAB

Alla fine dell’attività il server si riavvierà. E’ possibile verificare l’avvenuta installazione del ruolo attraverso il CmdLet Get-WindowsFeature.

Di seguito il contenuto dei due files utilizzati nel seguente articolo. Sono riutilizzabili secondo le proprie specifiche esigenze.

Active-Directory-Domain-Services.xml
#INIZIO FILE
<Objs Version=”1.1.0.1″ xmlns=”http://schemas.microsoft.com/powershell/2004/04″>
<Obj RefId=”0″>
<TN RefId=”0″>
<T>System.Collections.ObjectModel.Collection`1[[System.Management.Automation.PSObject, System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
<T>System.Object</T>
</TN>
<LST>
<Obj RefId=”1″>
<TN RefId=”1″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_AD_Domain_Services</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_AD_Domain_Services</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_AD_Domain_Services</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>10</I32>
<Obj N=”__ClassMetadata” RefId=”2″>
<TN RefId=”2″>
<T>System.Collections.ArrayList</T>
<T>System.Object</T>
</TN>
<LST>
<Obj RefId=”3″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
<S N=”MiXml”>&lt;CLASS NAME=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”locale” TYPE=”sint32″ TOSUBCLASS=”false”&gt;&lt;VALUE&gt;1033&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
<Obj RefId=”4″>
<MS>
<S N=”ClassName”>ServerComponent_AD_Domain_Services</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90162360</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_AD_Domain_Services” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;8.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;AD-Domain-Services&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
<Obj RefId=”5″>
<TN RefId=”3″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_GPMC</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_GPMC</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_GPMC</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>69</I32>
<Obj N=”__ClassMetadata” RefId=”6″>
<TNRef RefId=”2″ />
<LST>
<Obj RefId=”7″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
</MS>
</Obj>
<Obj RefId=”8″>
<MS>
<S N=”ClassName”>ServerComponent_GPMC</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-89744408</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_GPMC” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;6.3.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;GPMC&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
<Obj RefId=”9″>
<TN RefId=”4″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_RSAT</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>67</I32>
<Obj N=”__ClassMetadata” RefId=”10″>
<TNRef RefId=”2″ />
<LST>
<Obj RefId=”11″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
</MS>
</Obj>
<Obj RefId=”12″>
<MS>
<S N=”ClassName”>ServerComponent_RSAT</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-89385304</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_RSAT” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;8.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;RSAT&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
<Obj RefId=”13″>
<TN RefId=”5″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_AD_AdminCenter</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_AD_AdminCenter</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_RSAT_AD_AdminCenter</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>330</I32>
<Obj N=”__ClassMetadata” RefId=”14″>
<TNRef RefId=”2″ />
<LST>
<Obj RefId=”15″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
</MS>
</Obj>
<Obj RefId=”16″>
<MS>
<S N=”ClassName”>ServerComponent_RSAT_AD_AdminCenter</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-89387384</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_RSAT_AD_AdminCenter” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;RSAT-AD-AdminCenter&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
<Obj RefId=”17″>
<TN RefId=”6″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_AD_PowerShell</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_AD_PowerShell</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_RSAT_AD_PowerShell</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>331</I32>
<Obj N=”__ClassMetadata” RefId=”18″>
<TNRef RefId=”2″ />
<LST>
<Obj RefId=”19″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
</MS>
</Obj>
<Obj RefId=”20″>
<MS>
<S N=”ClassName”>ServerComponent_RSAT_AD_PowerShell</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-89379064</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_RSAT_AD_PowerShell” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;RSAT-AD-PowerShell&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
<Obj RefId=”21″>
<TN RefId=”7″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_AD_Tools</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_AD_Tools</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_RSAT_AD_Tools</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>329</I32>
<Obj N=”__ClassMetadata” RefId=”22″>
<TNRef RefId=”2″ />
<LST>
<Obj RefId=”23″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
</MS>
</Obj>
<Obj RefId=”24″>
<MS>
<S N=”ClassName”>ServerComponent_RSAT_AD_Tools</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-89372824</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_RSAT_AD_Tools” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;RSAT-AD-Tools&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
<Obj RefId=”25″>
<TN RefId=”8″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_ADDS</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_ADDS</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_RSAT_ADDS</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>257</I32>
<Obj N=”__ClassMetadata” RefId=”26″>
<TNRef RefId=”2″ />
<LST>
<Obj RefId=”27″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
</MS>
</Obj>
<Obj RefId=”28″>
<MS>
<S N=”ClassName”>ServerComponent_RSAT_ADDS</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-89373864</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_RSAT_ADDS” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;RSAT-ADDS&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
<Obj RefId=”29″>
<TN RefId=”9″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_ADDS_Tools</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_ADDS_Tools</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_RSAT_ADDS_Tools</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>299</I32>
<Obj N=”__ClassMetadata” RefId=”30″>
<TNRef RefId=”2″ />
<LST>
<Obj RefId=”31″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
</MS>
</Obj>
<Obj RefId=”32″>
<MS>
<S N=”ClassName”>ServerComponent_RSAT_ADDS_Tools</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-89376984</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_RSAT_ADDS_Tools” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;0.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;RSAT-ADDS-Tools&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
<Obj RefId=”33″>
<TN RefId=”10″>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RSAT_Role_Tools</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RSAT_Role_Tools</T>
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T>
<T>Microsoft.Management.Infrastructure.CimInstance</T>
<T>System.Object</T>
</TN>
<ToString>ServerComponent_RSAT_Role_Tools</ToString>
<Props>
<S N=”PSComputerName”></S>
</Props>
<MS>
<I32 N=”NumericId”>256</I32>
<Obj N=”__ClassMetadata” RefId=”34″>
<TNRef RefId=”2″ />
<LST>
<Obj RefId=”35″>
<MS>
<S N=”ClassName”>MSFT_ServerManagerServerComponentDescriptor</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-90168600</I32>
</MS>
</Obj>
<Obj RefId=”36″>
<MS>
<S N=”ClassName”>ServerComponent_RSAT_Role_Tools</S>
<S N=”Namespace”>ROOT/Microsoft/Windows/ServerManager</S>
<S N=”ServerName”></S>
<I32 N=”Hash”>-88587432</I32>
<S N=”MiXml”>&lt;CLASS NAME=”ServerComponent_RSAT_Role_Tools” SUPERCLASS=”MSFT_ServerManagerServerComponentDescriptor”&gt;&lt;QUALIFIER NAME=”dynamic” TYPE=”boolean”&gt;&lt;VALUE&gt;true&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”provider” TYPE=”string”&gt;&lt;VALUE&gt;deploymentprovider&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”ClassVersion” TYPE=”string”&gt;&lt;VALUE&gt;8.0.0&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;QUALIFIER NAME=”DisplayName” TYPE=”string” TRANSLATABLE=”true”&gt;&lt;VALUE&gt;RSAT-Role-Tools&lt;/VALUE&gt;&lt;/QUALIFIER&gt;&lt;/CLASS&gt;</S>
</MS>
</Obj>
</LST>
</Obj>
</MS>
</Obj>
</LST>
</Obj>
</Objs>
#FINE FILE

dcpromo-ps.ps1
#INIZIO FILE
Param(
[string]$NomeDominio,
[string]$NomeNetBIOS
)

echo $NomeDominio
echo $NomeNetBIOS

Import-Module ADDSDeployment
Install-ADDSForest `
-CreateDnsDelegation:$false `
-DatabasePath “C:\Windows\NTDS” `
-DomainMode “Win2012R2” `
-DomainName $NomeDominio `
-DomainNetbiosName $NomeNetBIOS `
-ForestMode “Win2012R2” `
-InstallDns:$true `
-LogPath “C:\Windows\NTDS” `
-NoRebootOnCompletion:$false `
-SysvolPath “C:\Windows\SYSVOL” `
-Force:$true
#FINE FILE

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *