Using PowerShell to Add a Network Printer for All Users of a Computer

Purpose

This brief article details the commands necessary to use PowerShell to add/install/map a network printer for all users of a computer.

Prerequisites

The below actions require the executing user to have administrative rights to the workstation in question.

Solution

Establish a Remote PowerShell session

In an elevated PowerShell session (running as administrator), run the following command;

Enter-PsSession -ComputerName HOSTNAME.FQDN

where HOSTNAME.FQDN is the fully-qualified domain name of the workstation in question.

Example: desktop01.yourdomain.com

You can actually execute this process using the short name of the computer instead of the FQDN.

Remove the network printer for all users

Once you’ve entered the remote PowerShell session successfully, run the following commands in sequence;

RUNDLL32 PRINTUI.DLL,PrintUIEntry /ga /n\\PRINTSERVER\Shared-printer

where PRINTSERVER is the NETBIOS name of your print server from which the printer is shared and Shared-printer is the shared name of the printer you’d like to add/install/map.

When this is complete, the network printer should be uninstalled/removed for all users on that workstation. This can be verified by having users logon and check their Devices and Printers window.

Using PowerShell to Remove a Network Printer for All Users of a Computer

Purpose

This brief article details the commands necessary to use PowerShell to remove a network printer for all users of a computer.

Prerequisites

The below actions require the executing user to be an administrator of the remote workstation, or a Domain Administrator.

Solution

Establish a Remote PowerShell session

In an elevated PowerShell session (running as administrator), run the following command;

Enter-PsSession -ComputerName HOSTNAME.FQDN

where HOSTNAME.FQDN is the fully-qualified domain name of the workstation in question.

Example: desktop01.yourdomain.com

You can actually perform these commands without using the FQDN, and using the short name instead.

Remove the network printer for all users

Once you’ve entered the remote PowerShell session successfully, run the following commands in sequence;

Get-WmiObject -Class Win32_Printer | where{$_.Name -eq ‘\\PRINTSERVER\Shared-printer‘}

where PRINTSERVER is the NETBIOS name of your print server from which the printer is shared and Shared-printer is the shared name of the printer you’d like to remove. This command will return the printer that you’d like to remove, if it is installed for the user running the command. Even if the user running the command does not have this printer installed, this process will still work as intended.

Get-WmiObject -Class Win32_Printer | where{$_.Name -eq ‘\\PRINTSERVER\Shared-printer‘}| foreach{$_.delete()}

again, where PRINTSERVER is the NETBIOS name of your print server from which the printer is shared and Shared-printer is the shared name of the printer you’d like to remove.

When this is complete, the network printer should be uninstalled/removed for all users on that workstation. This can be verified by having users logon and check their Devices and Printers window.

Fix Windows Mobile Device Center Hanging at Launch and Mobile Devices Will Not Connect

While Windows Mobile Device Center is largely considered a thing of the past in many environments, there are plenty of industries and situations where it is still used to connect and sync mobile devices such as Intermec scanners to other systems. With Windows 10 Update 1703, there was a change regarding svchost.exe that can cause this issue. In this blog post, I’ll explore the two changes I’ve discovered that have worked for me to resolve this issue.

Introduction

While Windows Mobile Device Center is largely considered a thing of the past in many environments, there are plenty of industries and situations where it is still used to connect and sync mobile devices such as Intermec scanners to other systems. With Windows 10 Update 1703, there was a change regarding svchost.exe that can cause this issue. In this blog post, I’ll explore the two changes I’ve discovered that have worked for me to resolve this issue.

Prerequisites

To resolve this issue, access to a local account on the affected device which is a member of the Local Administrators NT group is required.

Problem

When the Windows Mobile Device Center is launched, the splash screen appears and hangs at “Please wait while Windows Mobile Device Center starts…”

Additionally, if the application does launch successfully, mobile devices may show connected on the mobile devices’ screens, but the Windows Mobile Device Center will show them as “Not Connected.”

Environment

Workstations with Windows 10 Professional or Enterprise Version 1703 or newer and Windows Mobile Device Center installed. This issue is operating system architecture agnostic. Affected workstations have Intermec handheld computers seated in their dock, which is attached to the affected workstation via USB cable.

Cause

Update 1703 for Windows 10, like other Windows updates, may revert older version of .NET Frameworks to be disabled; additionally, Update 1703 also has a new feature related to svchost.exe: the services will not share by default the same svchost.exe, even they are assigned to be run within of the same group with -k option. More detailed has been described in the winhelponline.com article under the Additional Reading section of this article.

Rapimgr and Wcescomm (Windows Mobile-based device connectivity and Windows Mobile-2003-based device connectivity) are such services: they are defined to be started in the same shared svchost.exe (-k WindowsMobile). RapiMgr creates a kernel semaphore AS_ACCEPTANCE_SEMA, because it starts first.  WcesComm tries to do this too, but fails: the semaphore has been already created and should be only opened. This will fail: not enough permissions (remember: two different svchost.exe, different SID, etc). So, wcescomm is just stopped.

Solution(s)

Enabling .NET Framework 3.5 Completely

Strike Win+R on the keyboard, and in the resulting Run Prompt, type appwiz.cpl then strike the Enter/Return key on the keyboard.

In the resulting Programs and Features window, select the Turn Windows features on or off option from the navigation pane at the left side of the window.

In the resulting Windows Features window, expand the option for .NET Framework 3.5 (includes .NET 2.0 and 3.0), then ensure it’s check box is fully enabled with a check mark–not a filled square–and that you do the same for the two child items, Windows Communication Foundation HTTP Activation and Windows Communications Foundation Non-HTTP Activation, then click OK. Windows will take a few moments to enable the selected features.

At this point, it is recommended that you restart/reboot the workstation.

Adding “SvcHostSplit Disable” in the System Registry

Warning: Editing the system’s registry can be dangerous unless you know exactly what you are doing. It is advisable that if a solution exists without editing the registry, that it be the selected resolution. If editing the registry is required, always export a backup of the working registry to both the local hard drive as well as removable storage prior to proceeding. Alternatively, a System Restore Point may be set.

Strike Win+R on the keyboard, and in the resulting Run Prompt, type regedit then strike the Enter/Return key on the keyboard.

In the resulting Registry Editor window, select File from the menu bar at the top of the window, then Export to save a backup of the affected workstation’s registry. When completed, close the Registry Editor.

Open an elevated Command Prompt shell (running as administrator. This can be done by clicking the Start Menu icon on the Taskbar in the bottom-left corner of the desktop environment and typing cmd then right-clicking the Command Prompt result and selecting Run as Administrator. Note that this must be done from a local account that is a member of the Local Administrators NT group on the affected workstation. Alternatively, you may browse to C:\WINDOWS\System32 and right-click cmd.exe and select Run as Administrator.

In the resulting Administrator: Command Prompt window, paste the below commands in and strike the Enter/Return key in sequence.

REG ADD HKLM\SYSTEM\CurrentControlSet\Services\RapiMgr /v SvcHostSplitDisable /t REG_DWORD /d 1 /f1 REG ADD HKLM\SYSTEM\CurrentControlSet\Services\WcesComm /v SvcHostSplitDisable /t REG_DWORD /d 1 /f

When completed, you may close the Administrator: Command Prompt window.

Verifying Service Properties

Strike Win+R on the keyboard, and in the resulting Run Prompt, type services.msc then strike the Enter/Return key on the keyboard.

In the resulting Services window, locate the Windows Mobile-based device connectivity and Windows Mobile-2003-based device connectivity services. For each, do the following:

Right-click the desired service and from the context menu, select Properties.

In the Log On tab, ensure the second radio button is selected and that the This account: field displays Local Service. If the Local System account radio button is selected, you’ll need to change the selection to the second option and enter Local System in the This account: field. The password is blank. When complete, click Apply.

In the Recovery tab, ensure the drop-down menus for First failure:, Second failure:, and Subsequent failures: all have Restart the Service selected. When complete, click Apply.

When complete, click OK to close the Properties window for the service.

At this point, a reboot/restart of the affected workstation is required.

Upon startup, the Windows Mobile Device Center should launch normally when the Start Menu entry or desktop shortcut is clicked. Once the WMDC window is open and, subsequently, the Intermec mobile computer is docked, you should see the device begin to connect; this is indicated by a spinning green icon in the bottom-left quadrant of the Windows Mobile Device Center window. The device should then connect and use of Advantage Scan on the Intermec and Drop Utility on the affected workstation may be resumed.


Additional reading

https://social.technet.microsoft.com/Forums/office/en-US/9cab3e8e-6cc4-48e4-8ed9-d595bc83f04b/windows-mobile-device-centre

https://www.winhelponline.com/blog/view-resources-usage-each-service-svchost-windows-10/

Joining a Windows 10 Device to the Domain (Updated for Windows 10 Update 20H2)

Introduction

Up until Windows 10 Update 20H2, many people joined workstations and servers to their domain environment using methods such as accessing the Run Prompt and entering “control system” to access the System Information portion of Control Panel, then clicking the option to modify the name of the device (the resulting window gave you the option to join a domain). Or by visiting the Control Panel and navigating to: System and Security > System > Computer name,domain, and workgroup settings > Change Settings.

With the introduction of Update 20H2, Microsoft has altered this option. In Step 2 shown in the above screenshot, Windows administrators would usually expect the System Properties window to appear, where one could click “Change…” to change either the name of the computer or the domain/workgroup to which the workstation was joined. With Update 20H2, Step 2 of the above screenshot now opens to the Windows 10 Settings App, which many administrators have been reluctant to accept, as the Windows Properties window had previously remained largely unchanged since Windows 95.

While this isn’t a new method of joining a machine to the domain, it was often ignored since many administrators preferred the traditional method discussed in the first paragraph of this post, or primarily administer their domain via PowerShell. This brief article will walk through some options for joining a traditional local Active Directory domain, especially if you really just have to have that System Properties window.

All the methods outlined below assume the device is already connected to the domain’s network and has the appropriate network configuration.

Joining the Domain – Run Prompt

Strike together the Windows + R combination on the keyboard, or right-click the Start Menu icon and select “Run” to open the Run Prompt.

Type: sysdm.cpl and strike the Enter/Return key on the keyboard or click OK.

In the resulting System Properties window, click Change…

In the resulting Computer Name/Domain Changes window, select the radio button called “Domain:” and enter the domain you wish to join (example: yourdomain.com). When done, click OK.

You may be prompted for credentials; in order to join the domain, you’ll need the credentials of a domain user account which has permissions to join devices to the domain. A domain administrator account is typically used for this function.

After entering the requisite credentials, the device will prompt you to reboot. After rebooting, the device will have been joined to the domain.

Joining the Domain – PowerShell

We can also join a machine to a local domain via a Windows PowerShell command. If you’re like me and prefer to do most of your Windows administrator via the command line, this option is for you.

Launch PowerShell (running as administrator) and type the below command:

Add-Computer -DomainName "yourdomain.com" -Restart

You may be prompted for credentials; in order to join the domain, you’ll need the credentials of a domain user account which has permissions to join devices to the domain. A domain administrator account is typically used for this function.

After entering the requisite credentials, the device will reboot. After rebooting, the device will have been joined to the domain. Easy-peasy, and works as quickly as your can type assuming no network issues.

Joining the Domain – Win10 Settings App

Last–and least–is the Windows 10 Settings App. I just…do we have to? We should at least talk about it. Alright.

On the keyboard, press together the Windows+i combination to open the Windows 10 Settings app. Alternatively, you can right-click the Start Menu icon and select Settings.

In the resulting Settings window, click into the Accounts module.

In the resulting page, use the navigation pane at the left of the window to select the “Access work or school” option. Then, click Connect.

Once you’ve clicked Connect, you’ll have a Microsoft Account window appear. Near the bottom of the window, click the “Join this device to a local Active Directory domain” option. Of course, if you’re using Azure Active Directory (AAD), then you can of course use that option.

In the resulting Join a Domain window, input the domain you wish to join, then click Next.

Once you click Next, you’ll be prompted for the requisite domain administrator credentials, after which the computer will prompt you to reboot. Once reboot is complete, the device will then be joined to the domain.

Conclusion

While Windows 10 Update 20H2 removed what some people thought of as the most traditional way of joining a machine to the domain (via the control panel and system information window), there are still a host of other options available. My personal preference for a one-off quick-join remains the sysdm.cpl method via the Run Prompt for its ease of use, the fact that it has remained the same throughout windows versions even through the 20H2 update, and the face that it maintains the graphical user interface with which many folks are already familiar.

The Windows 10 Settings app method isn’t necessarily horrible, but it’s more navigation and more clicks to accomplish the same thing, hence why I feel so many Windows administrators dislike the approach. To Microsoft’s credit, it does make some sense given their Azure Active Directory offering and their push to get customers to the cloud. In previous Windows 10 update releases, I feel the software giant is pushing its customers more and more toward Azure and the cloud with various included products like synced Edge bookmarks, OneDrive, OneNote, etc. What do you think of the smaller administrative changes that Microsoft is making to Windows 10? I’d love to hear from you in the comments below.


Additional Reading

Join a Computer to a Domain | Microsoft Docs

PowerShell to join the computer to domain – Just Do Cloud

Installing Windows via bootable USB drive for Dell Precision 5820 Towers w/ FlexBay NVMe SSDs installed

Dell Precision 5820 towers require manual loading of the storage drivers during the Windows installation process. This brief article provides step-by-step walkthrough of how to accomplish this.

Prerequisites

In order to image a Dell Precision 5820 Tower that has a FlexBay NVMe solid-state drive installed, you’ll need the following:

  • The computer tower
  • Windows 10 ISO of your choice
  • Rufus bootable-USB creation software
  • USB flash drive with a minimum of 8GB of storage
  • The Intel Rapid Store Technology Enterprise driver for the virtual RAID and AHCI controllers

The process of obtaining the drivers and flashing the USB are covered in this article. If you already have your bootable USB Windows installer ready, skip to the Copying the driver section.

Obtaining the necessary drivers

To obtain the necessary drivers, look up the Service Tag of the workstation in question. See the Additional Resources section for links to the lookup website, driver download, and more.

Once you’ve downloaded the driver’s installer, run the executable. When the splash page pops up, select the “Extract” option instead of the Install option. Extract the driver files to a location of your choice.

Creating bootable USB Windows installer

Insert your chosen USB flash drive to your system. Download and run Rufus.

Select your device and ISO file.

Partition scheme = GPT

Target system = BIOS or UEFI

Give the drive a name and click Start. When finished, close Rufus but do not remove the drive from your system.

For this example, I already had a bootable USB installer for Windows 10 Update 20H2 prepared.

Copying the driver

In your newly created bootable USB flash drive, create a directory called “drivers” and another directory inside it called the workstation brand and model. The previous sentence is optional, but extremely helpful when organizing drivers for multiple systems on a single installer drive. Navigate to the directory to which you extracted the drivers. Cut or Copy these, and Paste them into the directory you just created on the bootable USB flash drive. In my example, the file system on the flash drive looks like this:

When done, remove the USB flash drive from your system.

Installing Windows

Insert the bootable USB flash drive in the Dell Precision 5820 or 7920 workstation in question. Power on the device.

At the Dell boot splash page, rapidly tap the F12 key on the keyboard until you see “Preparing one-time boot menu” at the top-right corner of the display.

When the one-time boot menu appears, use the arrow keys on the keyboard to scroll down to the “BIOS configuration” option, then strike the enter/return key on the keyboard to enter the BIOS configuration menu.

The following settings must be set/verified;

  • Secure Boot = Disabled
  • Boot Sequence > Boot Option = UEFI
  • Advanced Boot Options > Legacy Option ROMs = Enabled

Save all changes and reboot the system. Again, at the Dell boot splash page, rapidly tap the F12 key on the keyboard until you see “Preparing one-time boot menu” at the top-right corner of the display.

When the one-time boot menu appears, use the arrow keys on the keyboard to scroll down to your bootable USB flash drive, then strike the enter/return key on the keyboard to boot from your drive.

The Windows installer should now load. Continue through the Installation menu as you normally would until you reach the “Where do you want to install Windows?” screen.

At this screen, click “Load driver” and navigate to the directory on your bootable USB flash drive. Select the directory of the appropriate AHCI/SATA driver, then load the driver. The installer will do some scans, then return you to the screen above. If no drive appears at this point, that is normal.

Again, click “Load driver” and repeat the previous step, but this time selecting the appropriate RAID driver from the directory on your bootable USB flash drive. Load the driver. Once both drivers are loaded, you should now see the drive(s) in question available.

Proceed with the Windows installation as normal.


Additional Resources

Dell Precision 5820/7920: Imaging Steps for NVMe Drives in the Flex Bay

Dell Service Tag Lookup

Intel Rapid Store Technology Enterprise F6 Driver v5.3.1.1019_A03 – Download

Rufus – Download