-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerate-PrinterList.ps1
More file actions
20 lines (16 loc) · 913 Bytes
/
Generate-PrinterList.ps1
File metadata and controls
20 lines (16 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
param (
# Create Migration List
$newServer = "\\sftlpnt01",
$oldServer = "\\sftlfs01",
$printerListFile = "C:\Users\a1mpaschke\AppData\Local\Temp\printerlist.txt",
$siteCode = "FTL"
)
# $nameArr = 200..210 | ForEach-Object {"TestPrinter$_"}
$nameArr = Get-Content $printerListFile
$scratchDir = join-path $env:TEMP -ChildPath $siteCode
$printerColl = @()
foreach ($printer in $nameArr) {
$printerColl += 1 | Select-Object -Property @{"Name" = "PrinterUncPath";"Expression" = {Join-Path $newServer -ChildPath $printer}},@{"Name" = "Action";"Expression" = {"Update"}}
$printerColl += 1 | Select-Object -Property @{"Name" = "PrinterUncPath";"Expression" = {Join-Path $oldServer -ChildPath $printer}},@{"Name" = "Action";"Expression" = {"Delete"}}
}
$printerColl | Export-Csv -Path (Join-Path $scratchDir -ChildPath printerList.csv) -Force -Delimiter "," -NoTypeInformation