locked
Open Access database with powershell script in hidden mode. RRS feed

  • Question

  • Hello everyone, I have an Access database, I currently have a powershell script that opens the database to be able to do data import. 

    $Acc = New-Object –comObject Access.Application

    $Acc.visible = true
    $dest = "${datadir}bbdd.temp"
    If (Test-Path $dest) { Remove-Item $dest } 
    $Acc.CompactRepair($database,$dest,$true)
    Remove-Item $database
    Move-Item $dest $database

    $Acc.OpenCurrentDataBase($database)
    $conn = open_database -file $database
    .
    .
    script to import data
    .
    .
    close_database -connection $conn 
    $Acc.CloseCurrentDatabase(
    $Acc.Quit()

    Now I have added a login form with username and password, "I have the problem" that when running the script does two things I do not want it to do:
    1.- the access database is opened, I would like this import to be made in a hidden mode, that the access window does not appear
    2.- ask me the user and password that has the login form, I would like to take the login data of some text file.

    I would greatly appreciate your help, they have helped me to solve other issues previously.

    Thank you very much


    meyerker

    • Moved by Bill_Stewart Wednesday, November 29, 2017 6:27 PM This is not "scripts on demand"
    Tuesday, October 10, 2017 11:29 AM

All replies

  • Sorry but we cannot rewrite this script for you.  Try asking the author for help as it does not seem to be what you are asking form.

    Any Access database can be copy without opening it.  Just copy it.  You can also export tables from any Access database by just calling the Export function on the Access object.

    Post I the Access forum for help on how to do these things with an access database.

    To hide Access remove this line: $Acc.visible = true


    \_(ツ)_/

    Tuesday, October 10, 2017 12:48 PM