Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is because Windows is providing a different answer based upon the either the user running the script or may provide different responses based on 32-bit or 64-bit.

...

Code Block
languagepowershell
Param ( 
    [string]$MyUsername = $args[0],
    [string]$MyPassword = $args[1]
)


If ( [IntPtr]::Size * 8 -ne 64 )
{
    C:\Windows\SysNative\WindowsPowerShell\v1.0\PowerShell.exe -File $MyInvocation.MyCommand.Path -MyUsername $MyUsername -MyPassword $MyPassword
}
Else
{
    (New-LocalUser -AccountNeverExpires:$true -Password ( ConvertTo-SecureString -AsPlainText -Force $MyPassword) -Name $MyUsername | Add-LocalGroupMember -Group administrators)
}


macOS

On macOS, running using commands as sudo is not necessarily the same as actually becoming root.

...