Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using MS Powershell to Query MS Access with Complex SQL Query

Posted on 2008-10-30
1
Medium Priority
?
603 Views
Last Modified: 2013-12-22
Hello,

I am trying to query an MS Access DB from a PowerShell script using a fairly routine SQL statement and am running into a strange error.  I am using the methodology outlined here:

http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan08/hey0115.mspx

Which works fine for a standard SQL query.  But I want to use a WHERE statement in my query.  So line six would look like:

$objRecordset.Open("Select * From Computers WHERE operating_system = 'Windows XP'", $objConnection,$adOpenStatic,$adLockOptimistic)

But when I execute this line in PowerShell I get an error stating that the function call cannot accept five parameters.  Unfortunatly nothing I try helps me get around this issue.  I've tried -eq in place of the equals sign, placing the SQL in parentheses, etc and had no joy.

Does anyone know how to get around this issue?

Thank you!
0
Comment
Question by:bgsullivan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 18

Accepted Solution

by:
BSonPosh earned 1500 total points
ID: 22844377
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question