Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param($stage, $SPSQL)
- $ADDSSettings = @{Hostname = "SPDEV-DC";IPAddress = "192.168.1.10";Role = "DC";}
- $SQLSettings = @{Hostname = "SPDEV-SQL";IPAddress = "192.168.1.20";Role="SQL"}
- $SP2013Settings = @{Hostname = "SPDEV-SP2013";IPAddress = "192.168.1.120";Role="SP";Version = "2013"}
- $SP2013Settings = @{Hostname = "SPDEV-SP2010";IPAddress = "192.168.1.130";Role="SP";Version = "2010"}
- $SetupPath = "c:\Deploy";
- $NetBiosName = "pocketdomain";
- $TLD = "corp";
- $NetMask = "255.255.255.0";
- $Gateway = "192.168.1.1";
- $Password = "Abc123!";
- $SQLVersion = "11.0.2100.60";
- $SQLInstallPath = "D:";
- $SQLAgentUsername = "sqlagent";
- $SQLEngineUsername = "sqlengine";
- $UserListFileName = "DomainUserList.txt";
- $GroupListFileName = "DomainGroupList.txt";
- $UserOU = "SharepointUsers";
- $GroupOU = "SharepointUsers";
- $SQLConfigPath = "$SetupPath\sql\sql_configuration.ini";
- $AutoSPInstallerPath = "$SetupPath\sharepoint\autospinstaller";
- $CAHost = $ADDSSettings.Hostname;
- $DNSServer = $ADDSSettings.IPAddress;
- $DomainAdmin = "$NetBiosName\Administrator";
- $DomainName = "$NetBiosName.$TLD" ;
- $DomainUserPath = "OU=$UserOU,DC=$NetBiosName,DC=$TLD";
- $DomainGroupPath = "OU=$GroupOU,DC=$NetBiosName,DC=$TLD";
- $CAConfig = "$CAHost.$DomainName\$CAHost";
- $DomainUserList = Get-Content $SetupPath\$UserListFileName;
- $DomainGroupList = Get-Content $SetupPath\$GroupListFileName
- . $SetupPath\Functions.ps1
- $SharepointFunctions = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\sharepoint.ps1"
- If (Test-Path $SharepointFunctions) {. $SharepointFunctions}
- if (!($Stage -match "First_Run")) {Disable-Task "$Stage"}
- $Begin_ADDS_Scriptblock = {Initialize $ADDSSettings $Password $Gateway $DNSServer $DomainName $DomainAdmin}
- $Begin_SP2013_Scriptblock = {Initialize $SP2013Settings $Password $Gateway $DNSServer $DomainName $DomainAdmin}
- $Begin_SP2010_Scriptblock = {Initialize $SP2010Settings $Password $Gateway $DNSServer $DomainName $DomainAdmin}
- $Begin_SQL_Scriptblock = {Initialize $SQLSettings $Password $Gateway $DNSServer $DomainName $DomainAdmin}
- $Install_ADDS_ScriptBlock = {
- &$Install_Polipo_Scriptblock
- Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools
- Add-WindowsFeature -Name "dns" -IncludeAllSubFeature -IncludeManagementTools
- Add-WindowsFeature -Name "gpmc" -IncludeAllSubFeature -IncludeManagementTools
- }
- $Setup_ADObjects_Scriptblock = {
- Create-ADUsers $DomainUserList $DomainUserPath $Password $DomainName
- Create-ADGroups $DomainGroupList $DomainGroupPath
- Set-ADUser -Identity "Administrator" -EmailAddress "admin@$DomainName"
- }
- $Install_RSAT_Scriptblock = {Add-WindowsFeature RSAT-AD-Tools,RSAT-DNS-Server}
- $Install_Polipo_Scriptblock = {Start-Process -FilePath "C:\deploy\installs\polipo\Install_Polipo.cmd" -Wait}
- $Install_Forest_Scriptblock = {Install-Forest $DomainName $NetBiosName $DomainAdmin $Password}
- $Install_PKI_Scriptblock = {Install-PKI $NetBiosName $TLD}
- $Install_ADFS3_Scriptblock = {Install-ADFS3 $DomainName $CAConfig $NetBiosName $Password $DomainAdmin}
- $SP2013_PostInstall_ScriptBlock = { Finalize-SP2013 $DomainName $NetBiosName }
- $Install_Sharepoint_Scriptblock = { Install-Sharepoint $AutoSPInstallerPath }
- $Install_SQL_Scriptblock = { Install-SQL $SQLEngineUsername $SQLAgentUsername $Password $SQLInstallPath $SQLConfigPath $SQLVersion }
- $Setup_Sharepoint_Scriptblock = { Setup-Sharepoint $CAConfig $DomainName $AutoSPInstallerPath }
- switch ($Stage)
- {
- "First_Run_ADDS" {&$Begin_ADDS_Scriptblock; Add-Task Install_RSAT}
- "First_Run_SQL" {&$Begin_SQL_Scriptblock; Add-Task Install_SQL}
- "First_Run_SP2013" {&$Begin_SP2013_Scriptblock $SP2013Settings; Add-Task Setup_Sharepoint}
- "First_Run_SP2010" {&$Begin_SP2010_Scriptblock $SP2010Settings; Add-Task Setup_Sharepoint}
- "First_Run_Client" {&$First_Run_Scriptblock $Win7ClientSettings}
- "Setup_Sharepoint" {&$Setup_Sharepoint_Scriptblock; Add-Task Install_Sharepoint}
- "Install_Sharepoint" {&$Install_Sharepoint_Scriptblock}
- "Install_RSAT" {&$Install_RSAT_Scriptblock; Add-Task Install_ADDS}
- "Install_SQL" {&$Install_SQL_Scriptblock}
- "Install_ADDS" {&$Install_ADDS_ScriptBlock; Add-Task Install_Forest}
- "Install_Forest" {&$Install_Forest_Scriptblock; Add-Task Setup_ADObjects}
- "Install_PKI" {&$Install_PKI_Scriptblock; Add-Task Install_ADFS3}
- "Setup_ADObjects" {&$Setup_ADObjects_Scriptblock; Add-Task Install_PKI}
- "Install_ADFS3" {&$Install_ADFS3_Scriptblock; msgbox "Done."}
- "Install_ADFS2" {&$Install_ADFS2_Scriptblock}
- "SP2013_PostInstall" {&$SP2013_PostInstall_ScriptBlock}
- }
- if (!($Error[0])) {Restart-Computer} else {Write-Host "Errors!"; $Error | Select-Object * | Out-File c:\errors.txt -Append; notepad.exe c:\errors.txt}
- #Begin_ADDS
- #Install_RSAT
- #Install_ADDS
- #Install_Forest
- #Setup_ADObjects
- #Install_PKI
- #Install_ADFS3
- #Begin_SP2013
- #Setup_Sharepoint
- #Install_Sharepoint
- #Begin_SQL
- #Install_SQL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement