# Ejemplo de fichero: # asir1 # asir2 Set-Location C:\Users\juanito\pruebas2 foreach($nombre in Get-Content .\creacion.txt) { New-Item $nombre -ItemType Directory -Force Start-Sleep -Seconds 1 New-SmbShare -Name $nombre -Path ((Get-Location).Path+"\"+$nombre) -FullAccess todos Start-Sleep -Seconds 1 New-PSDrive -Name $nombre -PSProvider FileSystem -Root \\localhost\$nombre Start-Sleep -Seconds 1 }
Ejercicios de PowerShell: mapear varios recursos (unidades) creando también las carpetas y compartiendo, leyendo de un fichero el nombre (el mismo nombre para todas las operaciones) de la carpeta que se va a crear (New-Item), compartir (New-SmbShare) y mapear (New-PSDrive) (PowerShell)
Except where otherwise noted, Jesusninoc by Jesús N. is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.