How to change the SQL Express sa password from a command prompt

To change the SQL sa password from a command prompt:

Start a command prompt by typing Start – Run – cmd

Enter the following commands, pressing Enter after each line

OSQL -S Localhost\SQLExpress -E
1> EXEC sp_password NULL, ‘New password’, ‘sa’
2> GO

 

Try to connect SQL with new password

sqlcmd -U sa -P New_Password

or

sqlcmd -S Localhost\SQLExpress -U sa -P New_Password

Advertisements

Migrating FSMO Roles to Windows Server 2012

Once Windows server 2012 has been added to the forest as a new domain controller, on the new server after launching PowerShell command line, Wecan  use the

Move-ADDirectoryServerOperationMasterRole

command to transfer all the FSMO roles. EAch role corresponding to a number :

 

Role Name Number
PDCEmulator 0
RIDMaster 1
InfrastructureMaster 2
SchemaMaster 3
DomainNamingMaster 4

so command like

Move-ADDirectoryServerOperationMasterRole -Identity "DC2k12" -OperationMasterRole 0,1,2,3,4