I would like to add an existing local user to the SQL Server as a sysadmin, with PowerShell. fter some research I have the following script so far:
$Username = \
Found something simpler
Add-SqlLogin -ServerInstance -LoginName -LoginType -DefaultDatabase tempdb -Enable -GrantConnectSql -LoginPSCredential $Credential ((New-Object ('Microsoft.SqlServer.Management.Smo.Server') "").Roles | where {$_.Name -eq 'sysadmin'}).AddMember("")