1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
Set-Location C:\Users\juan\clase26\ function crearusuario($datos) { foreach($linea in $datos) { $password = ConvertTo-SecureString $linea.password -AsPlainText -Force New-LocalUser -Name $linea.nombre -Password $password New-Item -Name $linea.nombre -ItemType Directory Start-Sleep -Seconds 4 $rutadirectorio $rutadirectorio = ("C:\Users\juan\clase26\"+$linea.nombre) New-SmbShare -name $linea.nombre -path $rutadirectorio -FullAccess $linea.nombre } } crearusuario (Import-Csv C:\Users\juan\datos.txt) function hashproceso() { foreach($proceso in Get-Process) { if($proceso.Path) { Get-FileHash $proceso.Path } } } hashproceso | Out-File hashproceso.txt function hashdll() { foreach($dll in (Get-Process).Modules) { Get-FileHash $dll.filename } } hashdll | Out-File hashdll.txt |