diff --git a/Connect-Mstsc/Connect-Mstsc.ps1 b/Connect-Mstsc/Connect-Mstsc.ps1 index 28a78a2..3933d23 100644 --- a/Connect-Mstsc/Connect-Mstsc.ps1 +++ b/Connect-Mstsc/Connect-Mstsc.ps1 @@ -70,8 +70,8 @@ Sets the /h: parameter on the mstsc command: Specifies the height of the .NOTES Name: Connect-Mstsc Author: Jaap Brasser -DateUpdated: 2016-06-02 -Version: 1.2.3 +DateUpdated: 2016-10-28 +Version: 1.2.4 Blog: http://www.jaapbrasser.com .LINK @@ -192,8 +192,10 @@ An remote desktop session to server01 will be created using the credentials of c } if ($Credential) { - $User = $Credential.UserName + $User = $Credential.UserName $Password = $Credential.GetNetworkCredential().Password + } else { + $Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password)) } } process { diff --git a/DeleteOld/deleteold.ps1 b/DeleteOld/deleteold.ps1 index eea4d02..bb6144c 100644 --- a/DeleteOld/deleteold.ps1 +++ b/DeleteOld/deleteold.ps1 @@ -723,8 +723,8 @@ param( # Check if correct parameters are used if (-not $FolderPath) {Write-Warning 'Please specify the -FolderPath variable, this parameter is required. Use Get-Help .\deleteold.ps1 to display help.';exit} -if (-not $FileAge) {Write-Warning 'Please specify the -FileAge variable, this parameter is required. Use Get-Help .\deleteold.ps1 to display help.';exit} -if (-not $LogFile) {Write-Warning 'Please specify the -LogFile variable, this parameter is required. Use Get-Help .\deleteold.ps1 to display help.';exit} +if (-not $FileAge) {Write-Warning 'Please specify the -FileAge variable, this parameter is required. Use Get-Help .\deleteold.ps1 to display help.';exit} +if (-not $LogFile) {Write-Warning 'Please specify the -LogFile variable, this parameter is required. Use Get-Help .\deleteold.ps1 to display help.';exit} if ($Autolog) { # Section that is triggered when the -autolog switch is active # Gets date and reformats to be used in log filename