Skip to content

Commit

Permalink
密码不过期
Browse files Browse the repository at this point in the history
  • Loading branch information
dsx42 committed Jul 16, 2022
1 parent b15638e commit 59cedf4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions UnattendTool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1501,10 +1501,18 @@ Add-Content -Path $UnattendPath -Value ' </OOBE>'
Add-Content -Path $UnattendPath -Value ''
Add-Content -Path $UnattendPath -Value ' <FirstLogonCommands>'
Add-Content -Path $UnattendPath -Value ' <SynchronousCommand wcm:action="add">'
Add-Content -Path $UnattendPath -Value (' <CommandLine>cmd /c del /f /q %WINDIR%\Panther' + `
'\unattend.xml</CommandLine>')
Add-Content -Path $UnattendPath -Value ' <Order>1</Order>'
Add-Content -Path $UnattendPath -Value (' <CommandLine>cmd /C del /f /q %WINDIR%\Panther' `
+ '\unattend.xml</CommandLine>')
Add-Content -Path $UnattendPath -Value ' </SynchronousCommand>'
if ($Password) {
Add-Content -Path $UnattendPath -Value ''
Add-Content -Path $UnattendPath -Value ' <SynchronousCommand wcm:action="add">'
Add-Content -Path $UnattendPath -Value ' <Order>2</Order>'
Add-Content -Path $UnattendPath -Value (' <CommandLine>cmd /C wmic useraccount' `
+ " where 'Name=`"$FullName`"' set PasswordExpires=false</CommandLine>")
Add-Content -Path $UnattendPath -Value ' </SynchronousCommand>'
}
Add-Content -Path $UnattendPath -Value ' </FirstLogonCommands>'
Add-Content -Path $UnattendPath -Value ' </component>'
Add-Content -Path $UnattendPath -Value ' </settings>'
Expand Down

0 comments on commit 59cedf4

Please sign in to comment.