This post will focus on a method that should be able to be run on any Windows 2008 r2 server and above without an extra installs. It uses PowerShell, .NET 4 and ODP.NET. Also note that this is what you use once you have your sql query and you just want to set it to run on a schedule to get a .csv or some other delimited file.
I chose this method instead of others because PowerSchool has to be installed on Windows Servers and quite frankly we're a Windows Shop when it comes to servers. You can run this directly on the server that runs PowerSchool but I chose to use a server we use to warehouse, scrub and analyze a lot of our data. We also have lots of other servers that run specific applications for transportation/routing, food service, library systems and etc. and all of these are Windows boxes that have the base requirements.
Once I decided this would be my best method I used this post on the Hey, Scripting Guy! Blog to build my basic .ps1 scripts using ODP.NET. I wasn't as concerned with speed but more the 'simplify' part. So in summary of what that post talks about is:
- ODP.NET from Oracle
- Make sure you have .Net 4
- the ability to run .Net 4 in PowerShell
- Configure PowerShell to use newer .net. To do this, you need to create a config file, named PowerShell.Exe.Config according to (http://tfl09.blogspot.com/2010/08/using-newer-versions-of-net-with.html)
- bypassing the block (run PowerShell as Admin): Set-ExecutionPolicy RemoteSigned
- run this script by: .\query1.ps1
So get ODP.NET:
- create a folder called c:/autoexport or somewhere else on your Windows 7+ or 2008r2+ box.
- download the proper ODP.NET from Oracle
- extract that in your new folder under another folder called c:/autoexport/odp
Check if you have .NET 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' | sort pschildname -des | foreach-object {$_.name; $_.GetValue("Version");} | |
<# credit http://stackoverflow.com/questions/3487265/powershell-script-to-return-versions-of-net-framework-on-a-machine#comment3650817_3491193#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<configuration> | |
<startup useLegacyV2RuntimeActivationPolicy="true"> | |
<supportedRuntime version="v4.0.30319"/> | |
<supportedRuntime version="v2.0.50727"/> | |
</startup> | |
</configuration> |
Set-ExecutionPolicy RemoteSigned
Heres the sample script for Naviance Student import:
now that you have your delimited export file, you can use PowerShell and WinSCP to upload it. I'll probably write that part up too soon.
Wrap those up in a .bat file then schedule that with task scheduler!