Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
PSCredential Update
Browse files Browse the repository at this point in the history
  • Loading branch information
proxb committed Mar 29, 2016
1 parent 207d512 commit f0a9f02
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 47 deletions.
Binary file added PSGetModuleInfo.xml
Binary file not shown.
Binary file modified PoshWSUS.psd1
Binary file not shown.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PoshWSUS 2.3 Release Notes
Last Updated: 18 Feb 2015
PoshWSUS 2.3.1.1 Release Notes
Last Updated: 28 March 2016

!!!IMPORTANT!!!
Functions have been renamed from *-PoshWSUS* to *-PSWSUS* based on user feedback.
Expand Down
2 changes: 1 addition & 1 deletion ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PoshWSUS 2.3.1 Release Notes
PoshWSUS 2.3.1.1 Release Notes
Last Updated:


Expand Down
25 changes: 10 additions & 15 deletions Scripts/Set-PSWSUSEmailConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ function Set-PSWSUSEmailConfig {
.PARAMETER SmtpServerRequiresAuthentication
Used if smtp server requires authentication
.PARAMETER SmtpUserName
Username to submit if required by smtp server
.PARAMETER SMTPCredential
Credential to submit if required by smtp server
.PARAMETER StatusNotificationFrequency
Frequency (Daily or Weekly) to send notifications
Expand All @@ -42,10 +42,7 @@ function Set-PSWSUSEmailConfig {
Date/Time to send notifications
.PARAMETER UpdateServer
Name of the WSUS update server
.PARAMETER SmtpPassword
Password to user for smtp server connection.
Name of the WSUS update server
.PARAMETER PassThru
Displays object after completion
Expand Down Expand Up @@ -105,7 +102,7 @@ function Set-PSWSUSEmailConfig {
[Parameter(
Mandatory = $False, Position = 8,
ParameterSetName = 'account', ValueFromPipeline = $False)]
[string]$SmtpUserName,
[PSCredential]$SMTPCredential,
[Parameter(
Mandatory = $False, Position = 9,
ParameterSetName = '', ValueFromPipeline = $False)]
Expand All @@ -117,11 +114,7 @@ function Set-PSWSUSEmailConfig {
[Parameter(
Mandatory = $False,Position = 11,
ParameterSetName = '',ValueFromPipeline = $False)]
[string]$UpdateServer,
[Parameter(
Mandatory = $False,Position = 12,
ParameterSetName = 'account',ValueFromPipeline = $False)]
[string]$SmtpPassword
[string]$UpdateServer
)
Begin {
#Configure Email Notifications
Expand Down Expand Up @@ -156,8 +149,10 @@ function Set-PSWSUSEmailConfig {
} Else {
$email.SmtpServerRequiresAuthentication = $False
}
If ($SmtpUserName) {$email.SmtpUserName = $SmtpUserName}
If ($SmtpPassword) {$mail.SetSmtpUserPassword($SmtpPassword)}
If ($SMTPCredential) {
$email.SmtpUserName = $SMTPCredential.GetNetworkCredential().UserName
$mail.SetSmtpUserPassword($SMTPCredential.GetNetworkCredential().Password)
}
Switch ($StatusNotificationFrequency) {
"Daily" {$email.StatusNotificationFrequency = [Microsoft.UpdateServices.Administration.EmailStatusNotificationFrequency]::Daily}
"Weekly" {$email.StatusNotificationFrequency = [Microsoft.UpdateServices.Administration.EmailStatusNotificationFrequency]::Weekly}
Expand Down
34 changes: 5 additions & 29 deletions Scripts/Set-PSWSUSProxyServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ function Set-PSWSUSProxyServer {
.PARAMETER ProxyUserName
The user name to use when accessing the proxy server. The name must be less than 256 characters.
.PARAMETER ProxyUserDomain
The name of the domain that contains the user's logon account. The name must be less than 256 characters.
.PARAMETER ProxyPassword
Password to use when accessing the proxy.
.PARAMETER ProxyCredential
The user name and password to use when accessing the proxy server. The name must be less than 256 characters.
.PARAMETER UseSeparateProxyForSsl
Sets whether a separate proxy should be used for SSL communications with the upstream server.
Expand Down Expand Up @@ -83,9 +80,7 @@ function Set-PSWSUSProxyServer {
[Boolean]$UseProxy,
[ValidateLength(1, 255)][alias("SslProxyName")][string]$ProxyName,
[ValidateRange(0,65536)][alias("SslProxyServerPort")][int]$ProxyServerPort,
[ValidateLength(1, 255)][string]$ProxyUserName,
[ValidateLength(1, 255)][string]$ProxyUserDomain,
$ProxyPassword,
[PSCredential]$ProxyCredential,
# Gets or sets whether a separate proxy should be used for SSL communications with the upstream server.
[Boolean]$UseSeparateProxyForSsl,
[Boolean]$AnonymousProxyAccess,
Expand Down Expand Up @@ -127,14 +122,10 @@ function Set-PSWSUSProxyServer {
$config.ProxyServerPort = $ProxyServerPort
}#endif

if ($PSBoundParameters['ProxyUserName'] -ne $null)
if ($PSBoundParameters['ProxyCredential'] -ne $null)
{
$config.ProxyUserName = $ProxyUserName
$config.ProxyUserName = $ProxyCredential.GetNetworkCredential().UserName
}#endif
else
{
$config.ProxyUserName = $null
}

if ($PSBoundParameters['ProxyUserDomain'] -ne $null)
{
Expand All @@ -145,21 +136,6 @@ function Set-PSWSUSProxyServer {
$config.ProxyUserDomain = $null
}

if ($PSBoundParameters['ProxyPassword'])
{
# TO DO. Why Password dosen't set?
# Need secure connection with wsus
#$ProxyPassword = Read-Host -Prompt 'Enter Password' -AsSecureString
#$wsus.GetConfiguration().SetProxyPassword($ProxyPassword)

Write-Warning "SORRY! You need to specify password manually in console `n This issue we will fix in next release"
}#endif
elseif($PSBoundParameters['ProxyPassword'] -eq $null)
{
# if not SSL connection, ProxyPassword is read only
#$config.ProxyPassword = $null
}

if ($PSBoundParameters['AnonymousProxyAccess'] -ne $null)
{
$config.AnonymousProxyAccess = $AnonymousProxyAccess
Expand Down

0 comments on commit f0a9f02

Please sign in to comment.