Posted in
Exchange Server,
Windows Powershell |
No Comment | 5,093 views | 30/06/2011 23:47
Hello,
You can use this script as a function to prepare Active Directory for HE 2010.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| $ErrorCode = $Null
Import-Module ServerManager
$ADStatus = (Get-WindowsFeature RSAT-ADDS).Installed
If ($ADStatus -ne $True)
{
Write-Warning "You should install Active Directory Administration Tools (RSAT-ADDS)"
Write-Host " "
Write-Warning "Aborting.."
Start-Sleep 3
$ErrorCode = "500"
}
If ($ErrorCode -eq $Null)
{
Write-Host " "
$OrganizationName = Read-Host "Organization Name"
Write-Host " "
$CurrentLocation = (Get-Location).Path
$SetupFile = $CurrentLocation + "\setup.com"
If (!(Test-Path -Path $SetupFile))
{
$SetupFilePath = Read-Host "Setup File Path"
$SetupFile = $SetupFilePath + "\setup.com"
If (!(Test-Path -Path $SetupFile))
{
Write-Warning "Could not find setup.com file."
Write-Host " "
Write-Warning "Aborting.."
Start-Sleep 3
$ErrorCode = "550"
}
}
}
If ($ErrorCode -eq $Null)
{
&"$SetupFile" /PrepareAD /OrganizationName:$OrganizationName /hosting
Write-Host " "
Write-Host "AD preparation completed successfully."
Start-Sleep 3
$PrepareADStatus = "Completed"
}
else
{
$PrepareADStatus = "Failed"
} |
$ErrorCode = $Null
Import-Module ServerManager
$ADStatus = (Get-WindowsFeature RSAT-ADDS).Installed
If ($ADStatus -ne $True)
{
Write-Warning "You should install Active Directory Administration Tools (RSAT-ADDS)"
Write-Host " "
Write-Warning "Aborting.."
Start-Sleep 3
$ErrorCode = "500"
}
If ($ErrorCode -eq $Null)
{
Write-Host " "
$OrganizationName = Read-Host "Organization Name"
Write-Host " "
$CurrentLocation = (Get-Location).Path
$SetupFile = $CurrentLocation + "\setup.com"
If (!(Test-Path -Path $SetupFile))
{
$SetupFilePath = Read-Host "Setup File Path"
$SetupFile = $SetupFilePath + "\setup.com"
If (!(Test-Path -Path $SetupFile))
{
Write-Warning "Could not find setup.com file."
Write-Host " "
Write-Warning "Aborting.."
Start-Sleep 3
$ErrorCode = "550"
}
}
}
If ($ErrorCode -eq $Null)
{
&"$SetupFile" /PrepareAD /OrganizationName:$OrganizationName /hosting
Write-Host " "
Write-Host "AD preparation completed successfully."
Start-Sleep 3
$PrepareADStatus = "Completed"
}
else
{
$PrepareADStatus = "Failed"
}
Setup.com stores in Exchange 2010 SP1 DVD.