Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server PowerShell Extensions (SQLPSX) Part 2


SQL Server PowerShell Extensions (SQLPSX) Part 2

Author
Message
valenzat
valenzat
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 231
The CSV files are on the server and the sql agent is using a windows account
valenzat
valenzat
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 231
It seems to be a known issue..

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1565378&SiteID=1&pageid=0

It must something to do with permissions and the sql agent (although the account has local admin and is sa on the server). Ill keep looking and post any updates if I find anything.
valenzat
valenzat
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 231
I have stop all sql server services, manually added sysadmin sql server role to the windows account used by the agent and restarted all sql services and it is now working.
I am not sure if that really solved the problem but it seems fine and data is correctly bulk inserted to the db! Im now going through ssrs
Thanks for your help Chad
daytripper
daytripper
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 73
I had issues trying to run powershell from sql agent but got the following to work:

(1) use the SqlCmd in the step.
(2) created a batch file that containted the following:

REM change to the correct drive
I:
REM change to my working directory
cd \mydir
REM now call powershell script
C:\WINDOWS\SysWOW64\windowspowershell\v1.0\powershell.exe -Nologo -NoProfile -Noninteractive -Command "& 'I:\DataXfer\ssh\myscript.ps1'"

-------------------------------------------------------
NOTE: the string following the -Command
you must have a "& '\pathname_script' "
-------------------------------------------------------
Bryan Conlon
Bryan Conlon
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 184
Great article!

I found that I also had to change the $StartInfo.WorkingDirectory = "" in the Run-SmoToCSVFile script. This was not mentioned in the article that I saw.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search