# powershell.exe -ExecutionPolicy Bypass -File ".\Cp.ps1" $printers = Get-Printer | Select-Object -Property Name, DriverName, PortName Write-Host "Elerheto nyomtatok:" -ForegroundColor Cyan for ($i=0; $i -lt $printers.Count; $i++) { Write-Host "$i) $($printers[$i].Name)" } $defaultPrinter = "Microsoft Print to PDF" $choice = Read-Host "A masolando nyomtato sorszama (Enter = alapertelmezett: $defaultPrinter)" if ([string]::IsNullOrWhiteSpace($choice)) { $printer = $printers | Where-Object { $_.Name -eq $defaultPrinter } if (-not $printer) { Write-Host "Figyelem: az alapertelmezett nyomtato ($defaultPrinter) nem talalhato!" -ForegroundColor Yellow exit } } else { if ($choice -match '^\d+$' -and [int]$choice -ge 0 -and [int]$choice -lt $printers.Count) { $printer = $printers[$choice] } else { Write-Host "Hiba: Ervenytelen sorszam!" -ForegroundColor Red exit } } $newPrinterName = "$($printer.Name) - Masolat" $counter = 2 while (Get-Printer -Name $newPrinterName -ErrorAction SilentlyContinue) { $newPrinterName = "$($printer.Name) - Masolat$counter" $counter++ } Add-Printer -Name $newPrinterName -DriverName $printer.DriverName -PortName $printer.PortName Write-Host "Siker: '$($printer.Name)' nCOPY OK '$newPrinterName'" -ForegroundColor Green # Copy
5mp: bessel = otesi | otsi = c ➽ net: ncpa.cpl | compmgmt.msc | printmanagement.msc | timeout /t 10 | runas /user:AdminUser prog.exe | diskmgmt.msc | RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer"