且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查找使用Powershell登录到Access数据库的用户

更新时间:2023-02-02 22:06:49

这适用于我使用Office 2007及更高版本随附的较新ACE驱动程序的情况.

This works for me using the newer ACE drivers included with Office 2007 and higher:

$filepath = "C:\Users\u00\Documents\Northwind.mdb"
[guid]$guid = '947bb102-5d43-11d1-bdbf-00c04fb92675'

$ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=`"$filepath`";Persist Security Info=False;"
$conn = new-object System.Data.OleDb.OleDbConnection($ConnectionString)
$conn.open()
$conn.GetOleDbSchemaTable($guid,$null) 
$conn.close()

COMPUTER_NAME                    LOGIN_NAME 
-------------                    ---------- 
Z002                             Admin