Does a command-line client exist for Microsoft Jet database engine? - command-line

Is there such a thing as a shell-based command-line client for Microsoft's Jet database engine?
Something similar to SQLite 3.x (sqlite3.exe) for SQLite.

Will PowerShell be suitable? Fellow MVP Richard Siddaway has started a very interesting series of blog postings on using PowerShell and Access. You can ignore the Office 2010 tag on his blog postings. Also note that I know nothing about PowerShell.

This may suit:
Cscript.exe is a command-line version
of the Windows Script Host that
provides command-line options for
setting script properties.
With Cscript.exe, you can run scripts
by typing the name of a script file at
the command prompt. Like Microsoft
Internet Explorer, Windows Script Host
serves as a controller of Windows
Script compliant scripting engines,
but Windows Script Host has very low
memory requirements. Windows Script
Host is ideal for both interactive and
non-interactive scripting needs, such
as logon scripting and administrative
scripting.
Windows Script Host supports scripts
written in VBScript or JScript.
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wsh_runfromcommandprompt.mspx?mfr=true

Something like osql with the right data provider? http://msdn.microsoft.com/en-us/library/aa214012(SQL.80).aspx

Entering the conversation here 10 years after the original question, but I've played with a couple of tools that should work:
YouAccess (http://youaccess.sourceforge.net): "YouAccess is a free (donationware) lifesaver console µapplication intended for SQL management of Microsoft® Access™ databases from command line, including creating them."
JetSQLConsole (https://sourceforge.net/projects/jetsqlconsole): "A command line/console interface for Microsoft Access databases, very similar to the MySQL client application."

Related

update Unix permissions on a windows share

My Unix box has a mapping to a Windows share. On the Windows server, a Powershell script is copying folders to this share UDI/inbound throughout the day. On the Unix side where my Oracle database is running, I need to be able to update or write a file under one of these share folders. But permissions are blocking me. See visual below.
When looking at it from the Unix side, the owner/group(33448/32770) are different than my Unix login (orahubd/dba), so I cannot change the permissions from the Unix side. Is there some way from the Windows side, like in my Powershell script, to change the permissions so that Unix would allow me to write? I was able to set the permissions via Powershell to Everyone:Full, but that doesn't seem to change it from the Unix perspective.
I am an Oracle PL//SQL developer, just a novice dabbling in these other technologies.

Will a PowerShell script developed for a Windows 7 run on Win Server 2008 R2?

I have developed a large PowerShell script that has been refined on a Windows 7 64bit box and now I intend to run it on a Windows server 2008 r2. Assuming the PowerShell versions are the same, will there be any major issues with syntax in-between Win 7 and WS 2008 R2?
The script checks a lot of WMI and registry keys like GWmi Win32_NetworkLoginProfile and Get-Itemproperty -Path Registry::HKLM\Software\Microsoft\"Windows NT"\CurrentVersion\winlogon\
Most PowerShell information is driven towards managing servers so I assume I will be safe, but I want to see if you all can help me learn some lessons before I start banging my head against the wall.
Thanks
There are no syntax differences between PowerShell on Windows 7 and PowerShell on Windows Server 2008 R2. You may encounter differences in existing services, WMI classes, and registry keys, though.
First you should test it on a virtual machine to see if it works or not. Then try it on the physical machine. If it doesn't work, modify the code to the specific registry keys.
The short answer is yes. I run PSv4 on both my desktop and one of my servers running 08. Be sure to import the correct modules (if any) and allow for RPC in your firewall (And winrm) if applicable. One note- depending on what you run with the server, commands and functions are only as good as the version you run against (even when invoked). I ran into this problem as I scripted in v4 and environmentally my firm is almost all v2. Enabled -verbose error output and test in virtual machines or a loner laptop. (This is what I did). Good luck!

Using the U2 toolkit for .Net / UniObjects in Windows Powershell?

I'm a developer at a university in Chicago supporting Ellucian/Datatal Colleague on Unidata 7.2. We recently converted from Unidata on Unix to Windows Server and had a number of extract cron jobs that had to be converted to the new OS. During that conversion, I was introduced to the MS Windows Powershell Scripting Environment and have been using it to automate a lot of tasks that had been procedurally fragmented where the tasks were split up and executed asynchronously on different machines.
We are implementing the Ellucian Portal built on MS Sharepoint, and for that task we need to run a nightly job refreshing MS Active Directory attributes from our HR data. In order to do that I put together a Powershell script to take a flat file and update AD. However, the beauty of Powershell scripting is that you can work natively with .Net framework objects. I had developed a number of applications and utilities using VB UniObjects over the years and this seems to be a perfect opportunity to leverage the Powershell interface and build the extract step directly into the AD update script so the entire process can be executed as a single integrated application.
I've downloaded and installed the U2 toolkit for .Net from Rocket software but I've run into a snag in that the Powershell reference and instantiation syntax is different than any of the Visual Studio languages. Though I've been able to make some progress and have been able to establish a U2 ADO connection with the U2.Data.Client namespace, I am still having trouble instantiating the Native UniObjects U2.Data.Client.UO objects properly.
I'm sure that it just a simple issue with referencing the libraries correctly, but I've never actually worked with the .Net framework before, and I can't seem to find any authoritative examples of using the U2 .Net library in Powershell. This forum appears to be a great resource and the progress I've made is due to posts I've found here. If anyone has any thoughts or expertise in both U2 and Powershell I'd love to hear if you have an opinion on how to make the magic happen.
Thank you for asking this question.
You can call very easily U2 Toolkit for .NET (U2NETDK) from Windows PowerShell.
See the enclosed screen shot.
I did the following:
Install U2 Toolkit for .NET
Refer the installed .NET U2NETDK assembly
Create Connection Object
Create Command Object
Open Connection
Execute ADO.NET Command ( SELECT FIRST_NAME, SURNAME FROM MEMBERS)
Fetch Data. Write data on the PowerShell
Close the Connection.
If you want to use UO.NET capability and you want to use read file, UniCommand, SelectList, then refer U2.Data.Client.UO.UniFile, U2.Data.Client.UO.UniCommand etc.
I hope this example will help other U2 .NET Users too.
See this example:
http://blogs.technet.com/b/threekings/archive/2008/07/18/ado-net-in-powershell-update-sql-data-example-sample.aspx
Thank you for trying U2NETDK' ADO.NET and windows PowerShell.
For Native Access ( Uniobjects API), you do not need UODOTNET.DLL.
We have embedded Uniobjects API in U2NETDK.
So you will refer U2.Data.Client and U2.Data.Client.UO namespaces. See below the script and screen shot.
Add-Type -Path "C:\Program Files (x86)\Rocket Software\U2 Toolkit for .NET\U2 Database Provider\bin\.NETFramework\v2.0\U2.Data.Client.dll"
$Connection = New-Object U2.Data.Client.U2Connection
$Connection.ConnectionString = "Database=XDEMO;User ID=administrator;Password=pass;Server=9.72.199.235;Persist Security Info=True;ServerType=universe;AccessMode=Native"
$Connection.Open()
$Session = $Connection.UniSession
$UniSelectList =$Session.CreateUniSelectList(2);
$UniFile = $Session.CreateUniFile("PRODUCTS");
$UniSelectList.Select($UniFile);
while (!$UniSelectList.LastRecordRead)
{
$sRecID = $UniSelectList.Next();
write-host $sRecID
}
$Connection.Close()

Application Deployment with Powershell

I've developed a Powershell script to deploy updates to a suite of applications; including SQL Server database updates.
Next I need a way to execute these scripts on 100+ servers; without manually connecting to each server. "Powershell v2 with remoting" is not an option as it is still in CTP.
Powershell v1 with WinRM looks the most promising, but I can't get feedback from my scripts. The scripts execute, but I need to know about exceptions. The scripts create a log file, is there a way to send the contents of the log file back to the "client" (the local computer making the remote calls)?
Quick answer is No. Long version is, possible but will involve lots of hacks. I developed very similar deployment script/system using PowerShell 2 last year. The remoting feature is the primary reason we put up with the CTP status. PowerShell 1 with WinRM is flaky at best and as you said, no real feedback apart from ok or failed.
Alternative that I considered included using PsExec, which is very much non-standard and may be blocked by firewall. The other approach involves using system management tools such as MS's System Center, but that's just a big hammer for a tiny nail. So you have to pick your poison...
Just a comment on this: The easiest way to capture powershell output is to use the start-transcript cmdlet to pipe console output to a file. We have a small snippet at the start of all our script that sends a log file with the console output from each script to a central file share, and names the log file with script name and date executed so that we'll have an idea of what happened. Its not too hard to pipe all those log files into a database for further processing either. Probably won't seolve all your problems, but would definitely help on the "getting data back" part.
best regards,
Trond

Powershell remoting with V1

Do you know of any good remoting solutions using powershell V1 (I know the V2 stuff is awesome, but my organization doesn't like using pre-release software). I don't need anything spectactular, just a way to kick off powershell script on another box and get the results back when they're done. I'm considering using sysinternals PSEXEC and export-csv/import-csv and just making something that works. I'd rather have someone else do the work, though.
I think PrimalScript's Remote Script Execution Engine would do what you're after. It does require a small service to be installed on remote computers, but you get unlimited licenses for that when you buy PrimalScript (Enterprise edition).
There's also a PSHRemoting project someone did.
N Software's NetCmdlets also come with a "PowerShell Server" (http://nsoftware.com/powershell/) which enables remoting.
There is a great article up on the PowerShell team blog that describes how to get some basic remoting working in V1.
Basically, PS V2 uses Windows Remote Management (WinRM) under the hood. Winrs is the command line tool used to work remotely with machines.
This tactic that Jeffrey talks about uses WinRS and some PowerShell trickery to get remoting working in V1. Its not as slick as V2, but you can definitely get some basic stuff working with it.
I have used PSExec successfully. You can also use WMI to kick off remote processes. Here is an example.
Lee Holmes has posted a solution using PSExec and xml (rather than csv) http://www.leeholmes.com/blog/CategoryView,category,guide.aspx