Enable Shared Memory Protocol (SQL Server PowerShell)
1
vote
0
answers
531
views
I`m trying to modify and use powershell script from learn.microsoft.com in order to enable SQL Shared Memory protocol on a remote server. But my issue is instead of connecting to provided ManagedComputer and ServerInstance parameters, the script tries to execute it locally and I get below error:
# Load the assemblies
$smo = 'Microsoft.SqlServer.Management.Smo.'
$wmi = new-object ($smo + 'Wmi.ManagedComputer').
# List the object properties, including the instance names.
$Wmi
$uri = "ManagedComputer[@Name='']/ ServerInstance[@Name='MSSQLSERVER']/ServerProtocol[@Name='Sm']"
$Sm= $wmi.GetSmoObject($uri)
$Sm.IsEnabled = $true
$Sm.Alter()
$Sm
**Exception calling "GetSmoObject" with "1" argument(s): "Attempt to retrieve data for object failed for ManagedComputer 'my computer name."**
Ive searched a lot for similar problems but none of the suggested solutions didnt help, as I want to enable the protocol on remote server and if it works, to automate the script by running on multiple instances. But for now, my aim is to make it work at least on one remote server. Will appreciate your thoughts on this.
Asked by Nizami Khalilbayli
(131 rep)
Aug 10, 2022, 09:56 AM