Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. Configuration hackathonDSC {
  2. param (
  3. $webDeployPackage
  4. )
  5.  
  6. # Install the IIS role
  7. WindowsFeature IIS
  8. {
  9. Ensure = "Present"
  10. Name = "Web-Server"
  11. }
  12. # Install the ASP .NET 4.5 role
  13. WindowsFeature AspNet45
  14. {
  15. Ensure = "Present"
  16. Name = "Web-Asp-Net45"
  17. }
  18.  
  19. Script DeployWebPackage
  20. {
  21. GetScript = {@{Result = "DeployWebPackage"}}
  22. TestScript = {$false}
  23. SetScript ={
  24. [system.io.directory]::CreateDirectory("C:\WebApp")
  25. $dest = "C:\WebApp\Site.zip"
  26. Remove-Item -path "C:\inetpub\wwwroot" -Force -Recurse -ErrorAction SilentlyContinue
  27. Invoke-WebRequest $using:webDeployPackage -OutFile $dest
  28. Add-Type -assembly "system.io.compression.filesystem"
  29. [io.compression.zipfile]::ExtractToDirectory($dest, "C:\inetpub\wwwroot")
  30. }
  31. DependsOn = "[WindowsFeature]IIS"
  32. }
  33.  
  34. # Copy the website content
  35. File WebContent
  36. {
  37. Ensure = "Present"
  38. SourcePath = "C:\WebApp"
  39. DestinationPath = "C:\Inetpub\wwwroot"
  40. Recurse = $true
  41. Type = "Directory"
  42. DependsOn = "[Script]DeployWebPackage"
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement