Xiaojiba
Xiaojiba

Reputation: 146

How to remove my password using net user?

I'm currently using this code to try to remove my password

net user $env:username ""

If I run it in a cmd it works, not in powershell I get the same result as if I had typed :

net user $env:username

Which are the informations from last password change etc.

Do you have any idea ? I tried using [string]::Empty instead of the quotes, but the password was literally [string]::Empty and putting it in a variable didn't do the job

Thanks in advance!

Upvotes: 0

Views: 70

Answers (1)

mhu
mhu

Reputation: 18041

Try this:

 net user $env:username `"`"

Upvotes: 1

Related Questions