当前位置: 动力学知识库 > 问答 > 编程问答 >

Powershell, Shared Access Database

问题描述:

I'm currently working on a tool at work. At user logon a script will run to create an XML document with computer information. It then initiates another script to edit the database with that information.

This works perfectly if used on my own computer. It also works on a coworkers when I remote in and run it manually. However. I've come to believe that it is because it's locking the database whenever it's attempting to update the database.

I want multiple machines to be able to write to it. Is this possible? How?

Keep in mind, must work with PowerShell 2.0.

$DataBaseFilePath = "\\SomeServer\SomeShare\SomeFolder\..."

$adOpenDynamic = 2

$adLockPessimistic = -1

$Connection = New-Object -ComObject ADODB.Connection

$RecordSet = New-Object -ComObject ADODB.Recordset

$Connection.Open("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = $($DataBaseFilePath)")

$RecordSet.Open("SELECT * FROM Clients WHERE ComputerName = '$($Env:COMPUTERNAME)'",

$Connection, $adOpenDynamic, $adLockPessimistic)

分享给朋友:
您可能感兴趣的文章:
随机阅读: