Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #################
- ## install IIS ##
- #################
- Import-Module servermanager
- Add-WindowsFeature web-server
- ###########################
- ## set log file location ##
- ###########################
- #create new directory if needed
- $e_drive_exist = Test-Path -Path "E:"
- if ($e_drive_exist -eq $false)
- {
- [console]::ForegroundColor = "red"
- read-host "E drive does not exist. Please manually set log directory. Press ENTER to exit script."
- [console]::ResetColor()
- exit
- }
- $folder_exist = Test-Path -Path E:\Logs
- if ($folder_exist -eq $false)
- {
- #create it
- New-Item -Path E:\Logs -ItemType directory
- }
- #load the existing XLM configuration file
- $xml = [xml](Get-Content C:\Windows\System32\inetsrv\config\applicationHost.config)
- #set server wide defaults
- $xml.configuration."system.applicationHost".sites.siteDefaults.logfile.directory = "E:\Logs"
- $xml.configuration."system.applicationHost".sites.siteDefaults.tracefailedrequestslogging.directory = "E:\Logs"
- #set individual site defaults
- $xml.configuration."system.applicationHost".log.centralW3CLogFile.directory = "E:\Logs"
- $xml.configuration."system.applicationHost".log.centralBinaryLogFile.directory = "E:\Logs"
- #save changes
- $xml.save('C:\Windows\System32\inetsrv\config\applicationHost.config')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement