Microsoft Intune Deployment (Microsoft Intune 部署)
AIT 可以部署為 MSI,然後使用 PowerShell 執行。
步驟 1
移至 Apps > Windows apps > Add (應用程式 > Windows 應用程式 > 新增)。
步驟 2
選取 Line-of-business app (業務應用程式)。
步驟 4
將其命名為 Autodesk Inventory Tool,並為 Publisher (發佈者) 選取 Autodesk,然後按一下 Next (下一步)。
步驟 5
將裝置使用者或群組加入到要掃瞄的裝置。
步驟 6
建立應用程式需要一些時間來部署,然後再執行後續步驟。
將 AIT 部署到端點後,現在可使用 2 個選項。
設定執行原則時可能需要進一步考慮。
選項 1 - 透過電子郵件傳送結果
使用者未連線至 VPN。
使用以下 PowerShell 指令碼將執行 AIT,然後透過電子郵件將結果傳送至指定的電子郵件地址。
此指令碼需要以使用者身分執行
$aitpath="C:\program files (x86)\Autodesk\Autodesk Inventory Tool\AIT.exe"
$computername= $env:computername
Start-Process -FilePath $aitpath -ArgumentList "/c $computername /fp /lu /rp /sl" -WindowStyle Hidden
Start-Sleep 80
rename-item -Path "C:\ProgramData\Autodesk\AIT\DataStore.xml" -NewName "C:\ProgramData\Autodesk\AIT\$computername.xml"
cd "C:\ProgramData\Autodesk\AIT"
$OL = New-Object -ComObject outlook.application
$name = hostname
$loc = (Get-Location).Path
$result = "$loc\$name.xml"
Start-Sleep 5
$mItem = $OL.CreateItem("olMailItem")
#change "[email protected]" to any preferred email address
$mItem.To = "[email protected]"
$mItem.Subject = "AIT Scan Results"
$mItem.Body = "Results from $name"
$mItem.Attachments.Add($result)
$mItem.Send()
Exit(0)
Click to copy
若要收集資料,請在 Inbox (收件匣) 下建立一個名為 AIT Results (AIT 結果) 的資料夾,並建立規則以移動主旨為 AIT Scan Results (AIT 掃瞄結果) 的所有電子郵件。
執行以下 PowerShell 指令碼,將附件解壓縮至資料夾。
# link to the folder
# replace "[email protected]" to your email address
$olFolderPath = "\\[email protected]\Inbox\Personal"
# set the location to temporary file
$filePath = "C:\test\"
# use MAPI name space
$outlook = new-object -com outlook.application;
$mapi = $outlook.GetNameSpace("MAPI");
$olDefaultFolderInbox = 6
$inbox = $mapi.GetDefaultFolder($olDefaultFolderInbox)
$olTargetFolder = $inbox.Folders | Where-Object { $_.FolderPath -eq $olFolderPath }
$emails = $olTargetFolder.Items
# process the emails
foreach ($email in $emails) {
$email.Attachments | foreach {
$fileName = $_.FileName
$_.saveasfile((Join-Path $filePath $fileName))
}
}
Click to copy
選項 2 - 中小企業共用
使用者透過 VPN 連線至可集中存取的伺服器。
使用以下指令碼將規劃檔修改為指定路徑,然後執行 AIT。
$filePath = "C:\Program Files (x86)\Autodesk\Autodesk Inventory Tool\AIT.exe.config"
$DataStorePath = '<value>Default</value>'
$UNCPATH = '<value>\\DC01\AIT\DATA\</value>'
$PerComputerDataStore = '<value>False</value>'
$SetToTrue = '<value>True</value>'
$aitPath = "C:\Program Files (x86)\Autodesk\Autodesk Inventory Tool\AIT.exe"
if (Test-Path $filePath)
{
(Get-Content $filePath) |
Foreach-Object { $_ -replace $DataStorePath, $UNCPATH } |
Foreach-Object { $_ -replace $PerComputerDataStore, $SetToTrue } |
Set-Content $filePath
}
Start-Sleep 20
Start-Process -FilePath $aitPath -ArgumentList "/c localhost /fp /lu /rp /sl" -WindowStyle Hidden
Click to copy