Jump to content

scottcopus

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by scottcopus

  1. Doh, that last line of script code in my last post should have been broken up into two lines. I guess vBulletin has a hard time with formatting of pasted code... and I guess the time has expired for more edits. 🤷 $TimeDiff = New-TimeSpan -Start $StartTime -End (Get-Date) "$(timestamp) Done. Finished in {0}m {1}s." -f [int][Math]::Floor($TimeDiff.TotalMinutes), $TimeDiff.Seconds
  2. [Attempted to fix formatting] At this point in time, I've implemented the following GPO settings & script on about 200 of our ~2000 lab & instructor (i.e. shared/multi-user) Win10 & Win11 endpoints. So far it seems to have resolved the issue where AD printers will occasionally fail to get installed. However, I still have noticed that Event Viewer still shows one of the errors "0x80070057 The parameter is incorrect" or "0x80070709 The printer name is invalid" and that it can sometimes take up to a couple minutes before the printer will show up in the "Printers & scanners" settings UI. One odd thing is that these event log errors will show early nearer to login time (sometimes), but there's no *more* related event logs at or near the time the occasionally-delayed printer installs finally happen. Here's hoping someone at Microsoft sees this and maybe acknowledges this as a bug and hopefully fixes it! I'm planning to roll this out to the remaining endpoints in a few days. But due to the holiday break and low population at my university between now and over winter break, I probably won't hear much feedback about the results until closer to February 2024. Here's my current solution in case it helps anyone else..... GPO settings: SAME AS BEFORE: - User\Preferences\Control Panel Settings\Printers - Shared Printer: MyPrinter, Action:Update, Share Path:\\server\printer, Set this printer as default printer:True NEW: Computer\Preferences\Windows Settings\Registry: - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider\RemovePrintersAtLogoff (REG_DWORD) = 1 NEW: GPO SHUTDOWN script: ex: \\server\share\path\Printers-ClientSideRenderingCleanup.ps1 This script cleans up all the cached Client Side Rendering user+printer connections. It's probably a good idea to run this script during shutdown/restart, otherwise it my require the Print Spooler service to be restarted because this deletes spooler-related registry keys, which I didn't want to do at startup/logon/etc. So after this is implemented, you basically need to wait a couple hours until group policy is refreshed on your clients (or manually run GPUPDATE), and then restart the endpoints. $scriptName = $MyInvocation.MyCommand.Name Start-Transcript -Path "$env:WINDIR\Logs\$scriptName.log" -Append function timestamp { return Get-Date -Format 'yyyy-MM-dd HH:mm:ss' } $StartTime = Get-Date $ClientSideRenderingRegKey = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider' If (Test-Path $ClientSideRenderingRegKey) { # Regex pattern for username SIDs (security identifiers) $SIDregex = 'S-1-5-21-\d+-\d+\-\d+\-\d+$' # Find and delete all the registry keys holding cached Client Side Rendering user+printer connections $UserRegKeys = Get-ChildItem "$ClientSideRenderingRegKey\*" | Where-Object {$_.PSChildName -match $SIDregex} "$(timestamp) Deleting cached Client Side Rendering user+printer connection registry keys..." if ($UserRegKeys) { $UserRegKeys | ForEach-Object { $_.Name $_ | Remove-Item -Recurse -Force } } else { "$(timestamp) None found." } } else { "$(timestamp) Creating registry key $ClientSideRenderingRegKey ..." New-Item -Path $ClientSideRenderingRegKey -Force | Out-Null } # Set this here, even though it's better it gets set permanently (like in the same or separate GPO) on all new OS deployments going forward $RegName = 'RemovePrintersAtLogoff' $RegValue = '1'$RegType = 'DWORD' "$(timestamp) Setting registry key $RegName=$RegValue ($RegType) ..." New-ItemProperty -Path $ClientSideRenderingRegKey -Name $RegName -Value $RegValue -PropertyType $RegType -Force | Out-Null $TimeDiff = New-TimeSpan -Start $StartTime -End (Get-Date)"$(timestamp) Done. Finished in {0}m {1}s." -f [int][Math]::Floor($TimeDiff.TotalMinutes), $TimeDiff.Seconds cheers, Scott
  3. Hi @georgeescott, We're also experiencing the '0x80070057 The parameter is incorrect' event log errors with the occasional (or sometimes frequent) printers not being mapped at first user logon. Our environment is mostly similar. In our labs/classrooms, while we don't have mandatory profiles, we do make use of the 'Delete user profiles older than a specified number of days on system restart' GPO too. I'm interested in whatever you found that may have helped solve this, including if you still use a script you mentioned. Also, has anyone noticed if this issue is consistent on both Win10 and Win11 equally? This is something I'm hoping to have time to test. cheers, Scott
×
×
  • Create New...