Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. Function Install-WEBService
  2. {
  3. [CmdletBinding()]
  4. Param
  5. (
  6. [Parameter(Position=0, Mandatory=$true, ParameterSetName='1-Settings')]
  7. [String]$User,
  8.  
  9. [Parameter(Position=1,Mandatory=$true,ParameterSetName='1-Settings')]
  10. [String]$Password,
  11.  
  12. [Parameter(ParameterSetName='1-Settings')]
  13. [ValidateSet("None", "NTLM/Kerberos")]
  14. [String]$Authentication = "None",
  15.  
  16. [Parameter(ParameterSetName='1-Settings')]
  17. [Alias('Port')]
  18. [int]${Port [Default is 8550]} = 8550,
  19.  
  20. [Parameter(ParameterSetName='1-Settings')]
  21. [Alias('Url')]
  22. [String]${Url [Default is OSDInfo]} = "OSDInfo",
  23.  
  24. [Parameter(ParameterSetName='1-Settings')]
  25. [ValidateSet("YES", "NO")]
  26. [Alias('SSL')]
  27. [String]${Use SSL [Default is No]} = "NO",
  28.  
  29. [Parameter(ParameterSetName='2-About')]
  30. [Switch]${`n`n`n Web Service Installer by `n`n Diagg/OSD-Couture.com`n`n`n`n`n OS|DC - Quality Deployment since 1884}
  31. )
  32.  
  33. $Port = ${Port [Default is 8550]}
  34. $url = ${Url [Default is OSDInfo]}
  35. $SSL = ${Use SSL [Default is No]}
  36.  
  37.  
  38. Write-Host "User: $User"
  39. Write-Host "Password: $Password"
  40. Write-Host "Authentication: $Authentication"
  41. Write-Host "Port: $Port"
  42. Write-Host "URL: $url"
  43. Write-Host "ssl: $ssl"
  44. }
  45.  
  46. cls
  47. $RemapAliasTable = @{
  48. 'Url [Default is OSDInfo]' = 'Url'
  49. 'Port [Default is 8550]' = 'Port'
  50. 'Use SSL [Default is No]' = 'SSL'
  51. }
  52.  
  53. $Result = Show-Command Install-WEBService -NoCommonParameter -PassThru
  54. If (($Result -like "*-user*") -and ($Result -like "*-password*"))
  55. {
  56. Foreach ($Item in $RemapAliasTable.GetEnumerator()){If ($Result -match [Regex]::Escape($item.name)){$Result = $Result -replace [Regex]::Escape($Item.Name), $Item.value}}
  57. Invoke-Expression $Result
  58. }
  59. Else
  60. {Write-Host "Missing parameters, please retry!!"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement