You can set the maximum memory through the UI prompts of SQL Server Management Studio(Make sure that the user you are using to connect to the database has the 'sysadmin' role.):
You can use sqlcmd to pass T-SQL commands to modify the maximum memory.
1.Check the sqlcmd version information.
Get-Command sqlcmd
2.Log in to the database.
Windows Authentication:
sqlcmd -S .\INSTANCENAME -E
Account Password Verification:
sqlcmd -S .\INSTANCENAME -U YourUserName -P YourPassword
3.Enable advanced options (if not already enabled)
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
4.Set the maximum memory (in MB).
EXEC sp_configure 'max server memory', 4096;
RECONFIGURE;
GO