Skip to content

Instantly share code, notes, and snippets.

@diophung
Last active August 6, 2018 23:07
Show Gist options
  • Save diophung/7b98b68ac663ac02ba37e761dc2bd44e to your computer and use it in GitHub Desktop.
Save diophung/7b98b68ac663ac02ba37e761dc2bd44e to your computer and use it in GitHub Desktop.
Access MS SQL server on an AD domain using runas (from virtual machine or non-domain computer)
# The path to SSMS.exe depends on your SQL engine version:
# --------------
# 2008 R2: C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe
# 2012 : C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe
# 2014 : C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Ssms.exe
# 2016 : C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe
# Note the quotes
# --------------
# runas /netonly /user:<DOMAIN>\<user> "<path to SSMS>\Ssms.exe -S <SERVER IP or NAME>"
# --------------
# EXAMPLE:
# Server : SQL 2014 instance
# Server name : DB-QA-01
# Server address : 10.10.0.5
# User : COMPANY\USR
runas /netonly /user:COMPANY\USR "C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Ssms.exe -S 10.10.0.5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment