Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottZhuMS committed Sep 20, 2024
1 parent 2d71cd6 commit 3d5ba3e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions integrationtests/smb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ func randomString(length int) string {
}

func setupUser(username, password string) error {
cmdLine := fmt.Sprintf(`set "PSModulePath="` +
`;Import-Module Microsoft.PowerShell.Security -RequiredVersion 3.0.0.0` +
`;$PWord = ConvertTo-SecureString $Env:password -AsPlainText -Force` +
cmdLine := fmt.Sprintf(`$PWord = ConvertTo-SecureString $Env:password -AsPlainText -Force` +
`;New-Localuser -name $Env:username -accountneverexpires -password $PWord`)
cmd := exec.Command("powershell", "/c", cmdLine)
cmd.Env = append(os.Environ(),
fmt.Sprintf("username=%s", username),
fmt.Sprintf("password=%s", password))
fmt.Sprintf("password=%s", password),
"PSModulePath=") // Set the PSModulePath environment variable
if output, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("setupUser failed: %v, output: %q", err, string(output))
}
Expand Down

0 comments on commit 3d5ba3e

Please sign in to comment.