The sql server cmdlet (sqlps) and the remote server

I use the powershell sqlps module to get some data from my local database. My code is something like this

 PS C:\> Import-Module sqlps -DisableNameChecking PS SQLSERVER:\> cd "SQL\myMachineName\..." 

It works correctly, but sometimes I need to connect to a remote server running the SQL server, so I use Enter-PSSession . Is this correct or can I somehow display this server in the local directory SQLSERVER:\SQL ?

+6
source share
1 answer

The PowerShell provider for SQL Server can be used to connect to a remote SQL server without PowerShell remote access. For example, on a SQLSERVER drive: you can change the location to another SQL Server using

 PS SQLSERVER:\> cd "SQL\remoteMachineName\SQLInstanceName" 
+6
source

Source: https://habr.com/ru/post/946268/


All Articles