I want to launch SQL Server Management Studio using a PowerShell script. I know I could just launch the .exe to open it, but I also want to fill in the right server name and connect to it. The server name comes from parsing an XML file, which I already have the script configured to do. But I can't figure out how to pass it in and automatically connect to that server from a .ps1 file. Is there a simple way to do it?
Sure. According to the documentation , the following should do it:
ssms.exe -S $serverName -E
I tested it on my laptop and it worked for me.
这也有效:
start "filepath/ssms.exe"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.