Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Cannot open file because the current provider (SqlServer) cannot open a file. Expand / Collapse
Author
Message
Posted Tuesday, July 15, 2014 10:24 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, December 12, 2014 3:22 PM
Points: 49, Visits: 254
Server has SQL 2012
Opened powershell
sqlps
got PS SQLSERVER:\> prompt
PS SQLSERVER:\> echo "xxxx" > tempps.txt

This works fine in normal powershell. In sqlps I get error:
Cannot open file because the current provider (SqlServer) cannot open a file.

Well, I must have left out a step. Can somebody tell me how to get sqlps permission to open a file?
Post #1592670
Posted Tuesday, July 15, 2014 11:28 AM This worked for the OP Answer marked as solution


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 11:44 AM
Points: 60, Visits: 900
Add a path for the file. For example
echo 'xxxx' > C:\temp\tempps.txt
Post #1592706
Posted Tuesday, July 15, 2014 2:16 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, December 12, 2014 3:22 PM
Points: 49, Visits: 254
The full path works, though I am wondering why the command works in normal powershell without the path
and sqlps needs the path. I would ask why the error message lies and says sqlps doesn't have permission to open a file
but I figure, hey, this is Microsoft.

I don't quite follow the > syntax. What is that intended to do? I find that
echo 'xxxx' > C:\temp\tempps.txt errors out and that
echo 'xxxx' > C:\temp\tempps.txt does work.
Post #1592797
Posted Tuesday, July 15, 2014 2:19 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, December 12, 2014 3:22 PM
Points: 49, Visits: 254
I just noticed that the Ampersand gt in my last post translated as ">" so I guess that the forum kind of messed with the command you suggested.
Post #1592799
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse