Skip to content

Commit c4f1a75

Browse files
committed
Fix PSSA issue #2
1 parent bec88a2 commit c4f1a75

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

DSCR_AutoLogon.psd1

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# このモジュールのバージョン番号です。
15-
ModuleVersion = '2.0.0'
15+
ModuleVersion = '2.0.1'
1616

1717
# サポートされている PSEditions
1818
# CompatiblePSEditions = @()

DSCResources/cAutoLogon/cAutoLogon.psm1

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Get-TargetResource {
5959
}
6060
else {
6161
$private:LsaUtil = New-Object PInvoke.LSAUtil.LSAutil -ArgumentList "DefaultPassword"
62-
$EncryptedPassword = $LsaUtil.GetSecret()
62+
$private:EncryptedPassword = $LsaUtil.GetSecret()
6363
if ($EncryptedPassword) {
6464
Write-Verbose ('Password is encrypted')
6565
$GetRes.Encrypt = $true
@@ -79,7 +79,10 @@ function Get-TargetResource {
7979
else {
8080
$Fullname = $GetRes.Username
8181
}
82-
$SecPwd = ConvertTo-SecureString -String $Password -AsPlainText -Force
82+
83+
#$SecPwd = ConvertTo-SecureString -String $Password -AsPlainText -Force
84+
$SecPwd = New-Object System.Security.SecureString
85+
$Password.ToCharArray() | % {$SecPwd.AppendChar($_)} # Workaround for PSScriptAnalyzer issue
8386
$GetRes.AutoLogonCredential = New-Object System.Management.Automation.PSCredential $Fullname, $SecPwd
8487
}
8588

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ PowerShell DSC Resource to turn on / off automatic logon in Windows.
3030
Please look in the [Example](https://github.com/mkht/DSCR_AutoLogon/tree/master/Example) folder.
3131

3232
## ChangeLog
33+
### 2.0.1
34+
+ Fix PSSA Issues
35+
3336
### 2.0.0
3437
+ Supports password encryption
3538
+ Change resource type from composite to MOF-based.

0 commit comments

Comments
 (0)