Command to start an MS-Access-Database with security workgroup attribute with a Powershell Script

Kei-Koo 1 Reputation point
2021-01-11T17:23:25.677+00:00

Hi,

I'm new to Powershell scripting and I'm currently writing my first script.
I have a problem for which I haven't found a solution even after a long search on the web.Maybe someone here can put me on the right track.

In my script I wanna start an MSAccess database, with the /wrkgrp attribute.
Unfortunately, I can't get this running with a Powershell command.

A few informations:
The command line used in a local desktop shortcut to start the Database with secure workgroup:

"C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "\SRV2013-01.db.net\DBs\Database.mdb" /wrkgrp "\SRV2013-01.db.net\DBs\WGs\MyWorkgroup.mdw"

I can also enter this command line in the old CMD console and starting the database.

In Powershell I have already made several attempts, first with the "Invoke-Item" command:

Invoke-Item "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "\\SRV2013-01.db.net\DBs\Database.mdb" /wrkgrp "\\SRV2013-01.db.net\DBs\WGs\MyWorkgroup.mdw"

and then with the "Start-Process" command:

Start-Process "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "\\SRV2013-01.db.net\DBs\Database.mdb" /wrkgrp "\\SRV2013-01.db.net\DBs\WGs\MyWorkgroup.mdw"

So far without success.

As an alternative I used the following command that use the old CMD console.
This works, but I would like to change this code line to a "clean" Powershell command, without using the old CMD console command.

CMD /c "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "\\SRV2013-01.db.net\DBs\Database.mdb" /wrkgrp "\\SRV2013-01.db.net\DBs\WGs\MyWorkgroup.mdw"

I hope I was able to describe my concern clearly and now I hope for an interesting exchange.

Many Thanks

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2021-01-11T20:53:18.977+00:00

    Why not keep it simple and use the "Call" operator?

    & "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "\\SRV2013-01.db.net\DBs\Database.mdb" /wrkgrp "\\SRV2013-01.db.net\DBs\WGs\MyWorkgroup.mdw"
    
    1 person found this answer helpful.

  2. Biju Philip Jacob 1 Reputation point
    2021-09-09T15:40:00.027+00:00

    Thanks Rich

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.