# Add the nurse printer as a machine-level connection via Point and Print
# This makes it available to ALL users who log in
$printer = '\\CS-SERVER\Nurses - Brother MFC-L8900CDW'
# Check if already installed as local/machine printer
$existing = Get-Printer -Name $printer -ErrorAction SilentlyContinue
if ($existing -and $existing.Type -eq 'Local') {
    Write-Output "Already installed as machine printer: $printer"
} else {
    # Use rundll32 to install as machine-level
    & rundll32 printui.dll,PrintUIEntry /ga /n $printer 2>&1
    Write-Output "Added machine-level printer connection: $printer"
}
# Set as default for the machine
# Also add the Health Services printer the same way
$printer2 = '\\CS-SERVER\Health Services - Konica Minolta C368'
& rundll32 printui.dll,PrintUIEntry /ga /n $printer2 2>&1
Write-Output "Added machine-level printer connection: $printer2"
Write-Output ""
Write-Output "Both printers will be available to all users on next login."
Write-Output "Current printers:"
Get-Printer | Select-Object Name, Type | Format-Table -AutoSize
