PowerShell and network drives

In this tutorial on “scripting”, I suggest you discover or see how to manage network drives with PowerShell and you will see that it is not that “simple”. In the tutorial: Network Drive Mapping: GPO and Script, I explain how to map a network drive with Group Policy using and how to do it with …

Read more

Remove all network printers from a workstation

The script allows you to delete all network printers on a workstation / server. ‘ ‘ RDR REMOVE NETWORK PRINTER ‘ ‘ ‘ Dim strComputer strComputer = “.” Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”) Set colInstalledPrinters = objWMIService.ExecQuery (“Select * from Win32_Printer”) Set WshNetwork = WScript.CreateObject(“WScript.Network”) ‘msgbox “open script” ‘ Boucle sur les …

Read more

Hyper-V: create a virtual machine in PowerShell

In this tutorial, I will walk you through how to create a virtual machine on Hyper-V with PowerShell. The PowerShell commands of the tutorial, we were executed directly on the Hypervisor in a console launched in Administrator mode. Prerequisite: retrieve the name of the VMSwitch The first step will be to retrieve the name of …

Read more

Print server migration

The following script migrates from print server A to server B with the following actions: Map printers to the new server Removal of the workstation printers that are mapped to the old server only if they are present on the new one Changing the default printer if it is a printer from the old server. …

Read more

PowerShell: run multiple parallel robocopy

I offer a script that will allow you to launch several Robocopy simultaneously, this use saves a lot of time when using robocopy on a folder with several subfolders. In order to function the source must contain several subfolders. The files at the root of the source are not copied. Adapt the script Line 30: …

Read more

FOG agent installation script

The following script installs the FOG agent on fixed workstations at startup. The script must be placed in a group policy (GPO), which executes the script when the computer starts. Edit lines 8 and 9 by replacing fqdn with the URL to access the FOG server.

Restart an RDS server member of a farm

This script allows you to reboot a server RDS member of a farm with a broker session by closing the still open sessions. Use : Change the two variables $ServerBroker and $ServerHost. Create a scheduled task by running the script on the remote desktop session host server. Using the script avoids ending up with xxxxx.BACKUP-Y …

Read more

WSUS: Remove Drivers from Updates

Not long ago, I wanted to enable driver updates through WSUS. When I saw the amount of drivers to download compared to the percentage used, I wanted to backtrack. The problem is that once you synchronize to the WSUS database, you have to approve or reject the files. The solution to remove all traces of …

Read more