Contenido del fichero
1 2 3 4 |
0,juan,holapepe 0,diego,holapepe 1,diego |
Script
1 2 3 4 5 6 7 8 9 10 11 12 |
foreach ($linea in Get-Content .\usuarios.txt) { if($linea.Split(",")[0] -eq 1) { Remove-LocalUser $linea.Split(",")[1] -WhatIf } else { $pass = ConvertTo-SecureString $linea.Split(",")[2] -AsPlainText -Force New-LocalUser -Name $linea.Split(",")[1] -Password $pass -WhatIf } } |