Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Configuration hackathonDSC {
- param (
- $webDeployPackage
- )
- # Install the IIS role
- WindowsFeature IIS
- {
- Ensure = "Present"
- Name = "Web-Server"
- }
- # Install the ASP .NET 4.5 role
- WindowsFeature AspNet45
- {
- Ensure = "Present"
- Name = "Web-Asp-Net45"
- }
- Script DeployWebPackage
- {
- GetScript = {@{Result = "DeployWebPackage"}}
- TestScript = {$false}
- SetScript ={
- [system.io.directory]::CreateDirectory("C:\WebApp")
- $dest = "C:\WebApp\Site.zip"
- Remove-Item -path "C:\inetpub\wwwroot" -Force -Recurse -ErrorAction SilentlyContinue
- Invoke-WebRequest $using:webDeployPackage -OutFile $dest
- Add-Type -assembly "system.io.compression.filesystem"
- [io.compression.zipfile]::ExtractToDirectory($dest, "C:\inetpub\wwwroot")
- }
- DependsOn = "[WindowsFeature]IIS"
- }
- # Copy the website content
- File WebContent
- {
- Ensure = "Present"
- SourcePath = "C:\WebApp"
- DestinationPath = "C:\Inetpub\wwwroot"
- Recurse = $true
- Type = "Directory"
- DependsOn = "[Script]DeployWebPackage"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement