Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=======================================
- # 1. Invoke the script to Load IIS module
- # 2. Invoke the script to create webapplication
- # 3. Accepts user Name/password for the remote server and
- # 4. also the application pool username and password on which it has to run
- #=======================================
- param($userName, $plainTextPassword, $serverName, $poolUserName, $poolPassword)
- Try
- {
- $SecurePassword = $plainTextPassword | ConvertTo-SecureString -AsPlainText -Force
- $Credential = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $SecurePassword
- $scriptBlock = {
- param($poolUserName, $poolPassword)
- D:\Deployment\Scripts\ImportIISModule.ps1
- #create UnderwritingResponse
- D:\Deployment\Scripts\CreateApplication.ps1 $poolUserName $poolPassword "websitename under which virtual dir will be created" "VDIR Name" "path required on server"
- #create ClaimResponse
- D:\Deployment\Scripts\CreateApplication.ps1 $poolUserName $poolPassword "websitename under which virtual dir will be created" "VDIR Name" "path required on server"
- }
- $s = new-pssession -computerName $serverName -Credential $Credential
- invoke-command -Session $s -ScriptBlock $scriptBlock -ArgumentList $poolUserName, $poolPassword
- remove-pssession -session $s
- }
- Catch {
- "Exception: " + $_
- Break
- }
- finally {
- "Websites script completed"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement