‎10-12-2017 11:24 AM
"C:\Program Files (x86)\Lansweeper\Website\assetpictures"
"C:\Program Files (x86)\Lansweeper\Actions"
Select Top 1000000 tblAssets.AssetID As [Asset ID]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where tblAssetCustom.Model Like 'vvx201 ' And tblAssetCustom.State = 1
<#
Import Multiple Images to lansweeper
Script: MassPictureUpdate.ps1
Author: Stuart White
Date: 11/10/2017
#>
# Vars
$CSVPath = "\\ASSETSYSTEM\Lansweeper$\CSV\ImportImages.csv "
$ImagePath = "\\ASSETSYSTEM\Lansweeper$\CSV\ImportImage.jpg "
$LansweeperDir = "\\ASSETSYSTEM\assetpictures$\ "
#Test File Paths - If the Files exist continue else error message
$TestCSV = Test-Path $CSVPath -PathType leaf
$TestImages = Test-Path $ImagePath -PathType leaf
"Test CSV Path = " + $TestCSV + " / Test Image Path = " + $TestImages
if (($TestCSV) -and ($TestImages)){
$ImageExt = [IO.Path]::GetExtension($ImagePath)
$CSV = Import-Csv $CSVPath
$CSV | foreach-object {
$AssetID = $_."Asset ID;"
"The Image for Asset ID " + $AssetID + " has been Imported"
Copy-Item -Path $ImagePath -Destination "$LansweeperDir$AssetID$ImageExt"
}
#CleanUp
Remove-Item $ImagePath
Remove-Item $CSVPath
Read-Host "Press ENTER to continue..."
}else{
"Please Verify you have copied your csv and image file to the Actions\CSV Directory"
Read-Host "Press ENTER to continue..."
}
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now