The following error can prevent powershell scripts from running properly.

Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.

In order to get the powershell up and running again we will have to fix this.
This error is resulting from a network drive that is mounted by the user ‘System’.

Running Net use, even on an elevated CMD, the network drive is not visible and cannot be removed.

To remove it we will have to open a cmd with system rights.
There are more then one way to do this but the most easy one is PsExec.

PsExec is one of the legendary PsTools.
Download them and navigate to the directory.

The PsTools have been written by Mark Russinovich and then later been bought by Microsoft.
So you shoud be fine using them on productive systems.

With PsExec you can Spawn a Process on a remote device if the $admin share is active.
If you do not specify a certain context for this process ‘System’ will be used.

psexec.exe \\localhost -s cmd.exe

Net use should now show the drive.
Now you can delete it using net use DRIVELETTER: /delete /yes.