echo "`n"
echo "INSTALLAZIONE DI PAPERCUT: STAMPANTE E CLIENT"
echo "{INSTALLATION OF PAPERCUT PRINTER AND CLIENT}"
echo "`n"

if(Get-Printer|findstr papercut-2554){
	echo "Rimozione di una vecchia versione presente sul sistema..."
	echo "{Removing an old version found on the system...}"
	echo "`n"
	Start-Process -FilePath "C:\Windows\System32\rundll32.exe" -ArgumentList "printui.dll,PrintUIEntry /dl /n `"papercut-2554`" "
}

echo "Installazione del driver, per favore attendere..."
echo "{Installing drivers, please wait...}"
echo "`n"
Start-Process -Wait -FilePath "C:\Windows\System32\rundll32.exe" -ArgumentList "printui.dll,PrintUIEntry /ia /f .\PCL6\OEMsetup.inf /m `"Kyocera TASKalfa 2554ci KX`" "

Start-Sleep -s 3
Restart-Service -Name spooler
Start-Sleep -s 3

echo "Installazione del programma client"
echo "{Installing client program}"
echo "`n"
Start-Process -Wait -FilePath ".\win\client-local-install.exe" -ArgumentList "/silent"

IF ($?) 
{ 
echo "Aggiunto il programma PaperCut Client"
echo "{PaperCut Client program added}"
echo "`n"
}

echo "Installazione della stampante"
echo "{Installing printer}"
echo "`n"
Add-Printer -Name "papercut-2554" -DriverName "Kyocera TASKalfa 2554ci KX" -PortName "http://print.dei.unipd.it:631/printers/print"
IF ($?) { 
	echo "Aggiunta la stampante PaperCut-2554"
	echo "{PaperCut-2554 printer added}"
	echo "`n"
	Start-Sleep -s 3
	echo "IMPORTANTE! Impostare il bianco e nero come scelta predefinita"
	echo "{IMPORTANT! Please set Black and White as the default colour option}"
	Start-Sleep -s 5
	echo "`n"
	Start-Process -FilePath "C:\Windows\System32\rundll32.exe" -ArgumentList "printui.dll,PrintUIEntry /n `"papercut-2554`" /e"
}	
else{
	echo "Impossibile completare l'installazione della stampante!"
	echo "{Printer installation has failed!}"
}

PAUSE
