/image%2F0464672%2F20151005%2Fob_f99131_v4l-122973.jpg)
L'un des problèmes rencontré lors de la création de standard de masterisation c'est la normalisation des lettres logiques des lecteurs de CDROM. Il est important de comprendre qu'un serveur va vivre. C'est à dire que le nombre de lecteur logique C: D: E: ...etc... va sans doute évoluer selon les besoins. Il est donc plus facile de recaler le lecteur de CDROM vers la fin de la liste, càd , le plus possible vers Z:. Ce qui ne bloquera pas la creation d'un futur lecteur F:, par exemple....
Voici donc un script trouvé sur http://www.jhouseconsulting.com/ qui permet automatiquement de déplacer le CDROM vers Z: sauf si vous effectuez une installation à partir du lecteur de CDROM. Dans ce cas, la lettre utilisé sera Y: car le Z est dejà utilisé par WinPE.
<# This script will change the drive letter of all CDROM & DVD Drives found starting from whatever is set as $LastDriveLetter, working backwards until it finds an available drive letter. Example 1: If you have 1 CDROM/DVD drive mounted as D: and there is nothing using Z:, it will change the CDROM/DVD to Z: However, if Z: is already in use, it will use Y: instead, and so on. Example 2: If you have 2 CDROM/DVD drives mounted as D: and E:, it will change the CDROM/DVD on E: to Z: and D: to Y:. However, if Z: or Y: are already in use, it will use the next available drive letter. The whole point is to get them out of the way so that they don't interfere with DiskPart, etc. Remember that if you're running the script from an MDT Task Sequence, you're deployment share will already be mapped to Z: drive, so you're CDROM/DVD drive will typically end up as Y:. Syntax Examples: - Run the script without parameters to default to Z as the drive letter to start from: ChangeCDRomDriveLetter.ps1 - To specify T as the drive letter to start from: ChangeCDRomDriveLetter.ps1 -LastDriveLetter:t Script Name: ChangeCDRomDriveLetter.ps1 Release 1.1 Modified by Jeremy@jhouseconsulting.com 8th December 2014 #> #------------------------------------------------------------- param([string]$LastDriveLetter) If ([String]::IsNullOrEmpty($LastDriveLetter)) { $LastDriveLetter = "z" } Get-WmiObject win32_logicaldisk -filter 'DriveType=5' | Sort-Object -property DeviceID -Descending | ForEach-Object { write-host "Found CDROM drive on $($_.DeviceID)" $a = mountvol $_.DeviceID /l # Get first free drive letter starting from Z: and working backwards. # Many scripts on the Internet recommend using the following line: # $UseDriveLetter = Get-ChildItem function:[d-$LastDriveLetter]: -Name | Where-Object {-not (Test-Path -Path $_)} | Sort-Object -Descending | Select-Object -First 1 # However, if you run Test-Path on a CD-ROM or other drive letter # without any media, it will return False even though the drive letter # itself is in use. So to ensure accuracy we use the following line: $UseDriveLetter = Get-ChildItem function:[d-$LastDriveLetter]: -Name | Where-Object { (New-Object System.IO.DriveInfo($_)).DriveType -eq 'NoRootDirectory' } | Sort-Object -Descending | Select-Object -First 1 If ($UseDriveLetter -ne $null -AND $UseDriveLetter -ne "") { write-host "$UseDriveLetter is available to use" write-host "Changing $($_.DeviceID) to $UseDriveLetter" mountvol $_.DeviceID /d $a = $a.Trim() mountvol $UseDriveLetter $a } else { write-host "No available drive letters found." } }
Ce script est à placer dans une tache comme dans l’exemple ci dessous :
Sources :
Commenter cet article