Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling PowerShell script from Access 2010

Status
Not open for further replies.

txgeekgirl1

Programmer
Sep 10, 2009
85
US
I had a program written in VBA which called a PowerShell script to create Exch2010 mailbox accounts for new users. Worked fabulous with Access 2003. We moved our Databases to a newer server with Access 2010 on it. I have checked reference libraries and anything pertaining to the code - everything looks good. I then consulted the Microsoft boards for calling a PS Script from Access2010 but their solution does not work. If anyone has any suggestions or solutions - much appreciated!

Access 2003 code that worked:

Code:
'Call Powershell and run connection
    Call Shell("powershell -file ""c:\scripts\NewMailbox.ps1""", vbMaximizedFocus)

Access 2010 suggestion - does not work:

Code:
'Call Powershell and run connection
    Call Shell("C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -command c:\scripts\NewMailbox.ps1", vbMaximizedFocus)

The actual code in the file does run and work from the new server - so I just need to get the Call fixed.


 
Have you checked the version number portion of the path at all? Seems like that path leaves open a lot to error. I'd verify the full path for certain.

And just to see, have you tried w/o the vbMaximizedFocus? wouldn't hurt, and simple test.


"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top