# AutomatedServerSetup.ps1


## Overview

This Powershell script will automatically configure/setup a Windows server based on data provided in Variables.xml.   

Automation logs are saved to: C:\Windows\Temp\DPAutomation.log    
Automation errors are saved to: C:\Windows\Temp\DPAutomationErrors.log    
A registry key is updated throughout the process, tracking progress.  It can be used by an automation tool like Puppet to monitor the configuration.  
Note: If a post reboot script is detected in Variables.xml - Variables.PostConfiguration.PostReboot.PSCommand the key will not be updated to complete.   
If AutomatedServerSetup-Cleanup.ps1 is entered in Variables.PostConfiguration.PostReboot.PSCommand, the key will be updated to completed.    

## Source    

Public download link: https://toolkit.datapipe.net/BesTasks/anthony/AutomatedServerSetup/AutomatedServerSetup.ps1    

## Requirements
- Server 2012, Server 2012 R2.  

- Powershell execution policy must be set to unrestricted or bypass.   
`Set-ExecutionPolicy unrestricted -Force  

- AutomatedServerSetup.ps1 must be saved to the server.  Suggested location: C:\DPAutomation\AutomatedServerSetup.ps1    

- DP Windows Powershell module (DPWindowsPSM), saved to C:\DPAutomation\DPWindowsPSM.psm1 (unless the location is changed in Variables.xml - Variables.AutomationSettings.WindowsPSMPath.     
PSM link: https://toolkit.datapipe.net/BesTasks/anthony/WindowsPSM/DPWindowsPSM.psm1       

- Variables.xml must be saved to the server.  Suggested location: C:\DPAutomation\Variables.xml    

## Usage

- From an elevated Powershell command, run the script with -VariablesFile location as a parameter, pointing to your Variables.xml file.     
`Example: C:\DPAutomation\AutomatedServerSetup.ps1 -VariablesFile C:\DPAutomation\Variables.xml`


## Contributors

* Anthony Marino (<amarino@datapipe.com>)
