Could you please format your code as code using the preformatted text button ( </> )?
Thanks in advance.
Why do you have to run a CMD from a PowerShell script? I cannot imagine that there’s something you can do in CMD what you cannot do in pure PowerShell. You should migrate the CMD to PowerShell.
Regardless of that - the executable for a CMD would be C:\Windows\System32\cmd.exe. So the proper PowerShell command using Start-Process would be:
What do you mean by that? In CMD %username% is an environment variable representing the currently logged on user. The according PowerShell version would be $Env:USERNAME.
The %username% is the environment in the cmd, non it isn’t the current logged user, but a username that changes from time to time.
This script set the hard quota on NAS and changes from user to user