I'm trying to write a script which will patch SQL Instances remotely. Referring this forum, I have framed the following line for executing the .exe remotely on other server:
Invoke-Command -ComputerName $computer -ScriptBlock {& cmd /c 'D:\SQL_PATCH\SQLServer2012SP2-KB2958429-x64-ENU.exe' /qs /action=patch /allinstances /IAcceptSQLServerLicenseTerms}Also tried this as well:
Invoke-Command -ComputerName $computer -ScriptBlock {& 'D:\SQL_PATCH\SQLServer2012SP2-KB2958429-x64-ENU.exe' -ArgumentList "/qs", "/action=patch", "/allinstances", "/IAcceptSQLServerLicenseTerms"}Kindly help me on this.