File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,13 @@ func randomString(length int) string {
3030}
3131
3232func setupUser (username , password string ) error {
33- cmdLine := fmt .Sprintf (`set "PSModulePath="` +
34- `;Import-Module Microsoft.PowerShell.Security -RequiredVersion 3.0.0.0` +
35- `;$PWord = ConvertTo-SecureString $Env:password -AsPlainText -Force` +
33+ cmdLine := fmt .Sprintf (`$PWord = ConvertTo-SecureString $Env:password -AsPlainText -Force` +
3634 `;New-Localuser -name $Env:username -accountneverexpires -password $PWord` )
3735 cmd := exec .Command ("powershell" , "/c" , cmdLine )
3836 cmd .Env = append (os .Environ (),
3937 fmt .Sprintf ("username=%s" , username ),
40- fmt .Sprintf ("password=%s" , password ))
38+ fmt .Sprintf ("password=%s" , password ),
39+ "PSModulePath=" ) // Set the PSModulePath environment variable
4140 if output , err := cmd .CombinedOutput (); err != nil {
4241 return fmt .Errorf ("setupUser failed: %v, output: %q" , err , string (output ))
4342 }
You can’t perform that action at this time.
0 commit comments