Advertisement
Guest User

Untitled

a guest
May 10th, 2012
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #################
  2. ## install IIS ##
  3. #################
  4.  
  5. Import-Module servermanager
  6. Add-WindowsFeature web-server
  7.  
  8. ###########################
  9. ## set log file location ##
  10. ###########################
  11.  
  12. #create new directory if needed
  13. $e_drive_exist = Test-Path -Path "E:"
  14. if ($e_drive_exist -eq $false)
  15. {
  16.     [console]::ForegroundColor = "red"
  17.     read-host "E drive does not exist. Please manually set log directory. Press ENTER to exit script."
  18.     [console]::ResetColor()
  19.     exit
  20. }
  21.  
  22. $folder_exist = Test-Path -Path E:\Logs
  23. if ($folder_exist -eq $false)
  24. {
  25.     #create it
  26.     New-Item -Path E:\Logs -ItemType directory
  27. }
  28.  
  29. #load the existing XLM configuration file
  30. $xml = [xml](Get-Content C:\Windows\System32\inetsrv\config\applicationHost.config)
  31.  
  32. #set server wide defaults
  33. $xml.configuration."system.applicationHost".sites.siteDefaults.logfile.directory = "E:\Logs"
  34. $xml.configuration."system.applicationHost".sites.siteDefaults.tracefailedrequestslogging.directory = "E:\Logs"
  35.  
  36. #set individual site defaults
  37. $xml.configuration."system.applicationHost".log.centralW3CLogFile.directory = "E:\Logs"
  38. $xml.configuration."system.applicationHost".log.centralBinaryLogFile.directory = "E:\Logs"
  39.  
  40. #save changes
  41. $xml.save('C:\Windows\System32\inetsrv\config\applicationHost.config')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement