Solved

Using MS Powershell to Query MS Access with Complex SQL Query

Posted on 2008-10-30
1
550 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
1 Comment
 
LVL 18

Accepted Solution

by:
BSonPosh earned 500 total points
Comment Utility
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now