Esempi PowerShell - creazione della struttura di cartelle da un file CSV
Questo esempio crea una struttura di cartelle di gruppo da un file CSV.
Esempio
$csv = Import-Csv "c:\YourFolder\GroupFolder.csv"
foreach ($csvEntry in $csv) {
$groupName = $csvEntry.Name
# Extract the group folder name
if ($groupName.Contains("\")) {
$groupName = $groupName.Substring($groupName.LastIndexOf("\"), $groupName.Length - $groupName.LastIndexOf("\"))
$groupName = $groupName.TrimStart("\")
}
# Create the group folder if it is not null, empty or fill in with space characters
if (![]::IsNullOrWhiteSpace($groupName)) {
$session = New-RDMSession -Type "Group" -Name $groupName
$session.Group = $csvEntry.Name
Set-RDMSession $session
Write-Host "Group Folder $groupName created" -f Yellow
}
}
Update-RDMUINote
Il file CSV deve avere una sola colonna con il titolo impostato su Name.
Il percorso completo deve essere specificato per ogni sottocartella.
Ecco un esempio di questo file CSV:

PrecedenteEstrarre l'ID TeamViewer
SuccessivoRemote Desktop Manager macOS – Abilitare l'autenticazione integrata con Kerberos
Ultimo aggiornamento
È stato utile?