Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #=======================================
  2. # 1. Invoke the script to Load IIS module
  3. # 2. Invoke the script to create webapplication
  4. # 3. Accepts user Name/password for the remote server and
  5. # 4. also the application pool username and password on which it has to run
  6. #=======================================
  7. param($userName, $plainTextPassword, $serverName, $poolUserName, $poolPassword)
  8. Try
  9. {
  10.  
  11. $SecurePassword = $plainTextPassword | ConvertTo-SecureString -AsPlainText -Force
  12. $Credential = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $SecurePassword
  13.  
  14. $scriptBlock = {
  15. param($poolUserName, $poolPassword)
  16.  
  17. D:\Deployment\Scripts\ImportIISModule.ps1
  18.  
  19. #create UnderwritingResponse
  20. D:\Deployment\Scripts\CreateApplication.ps1 $poolUserName $poolPassword "websitename under which virtual dir will be created" "VDIR Name" "path required on server"
  21.  
  22. #create ClaimResponse
  23. D:\Deployment\Scripts\CreateApplication.ps1 $poolUserName $poolPassword "websitename under which virtual dir will be created" "VDIR Name" "path required on server"
  24.  
  25. }
  26.  
  27.  
  28. $s = new-pssession -computerName $serverName -Credential $Credential
  29.  
  30. invoke-command -Session $s -ScriptBlock $scriptBlock -ArgumentList $poolUserName, $poolPassword
  31.  
  32.  
  33.  
  34. remove-pssession -session $s
  35.  
  36.  
  37. }
  38. Catch {
  39. "Exception: " + $_
  40. Break
  41.  
  42. }
  43. finally {
  44. "Websites script completed"
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement