0

I am using PowerShell commands in my SQL job to get the list of files in a given network path.

Ex:

Get-ChildItem -path  \\\ServerName\ShareName\\

I have created proxies for PowerShell in SQL Server and using a credential to run this PowerShell script.

This was working fine until I upgraded SQL on the machine from SQL Server 2008 R2 to SQL Server 2014. After upgrading, same PowerShell scripts started throwing 'Cannot find path because it doesn't exist'

Any solutions please? (apart from specifying filesystem provider with path or using powershell.exe instead of sqlps)

FYI:

While upgrading to SQL Server 2014, I have received few errors related to reporting services, which I had ignored.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sandeep
  • 1
  • 1
  • Which user accounrd your SQL Server Service is using? – Atilla Ozgur Aug 02 '15 at 20:53
  • 1
    Have you checked SQL server connection manager to make sure noting was changed or needs to be turned on ie tcp protocols https://msdn.microsoft.com/en-us/library/ms174212.aspx – SoftwareCarpenter Aug 02 '15 at 20:54
  • Why do you say "apart from specifying filesystem"? Usually the problem is that SQLPS changes the path to a SQLSERVER: path and UNCs are interpreted by that provider rather than the filesystem. – Mike Shepard Aug 03 '15 at 02:26

2 Answers2

0

All network protocols are installed by SQL Server Setup, but may or may not be enabled.

Check SQL Configuration Manager, and ensure you have the needed protocols (shared memory, tcp/ip) enabled.

Here is a way to do it in your script if you do not want to use the configuration manager:

Enable or Disable a Server Network Protocol

SQL Server Configuration Manager

SoftwareCarpenter
  • 3,835
  • 3
  • 25
  • 37
0

You'll want to prefix the UNC path with "filesystem::".

See https://stackoverflow.com/a/27725079

Community
  • 1
  • 1
Matt Tucker
  • 175
  • 5