I try to make a script who create folder in a list of remote server. I make this but the problem who i see is the function not make correctly the path.
This is the code:
$p_serverstq = "\\127.0.0.1\test_share\logs" ,"\\192.168.1.10\test_share\logs"
$p_carpetas = "\servicio_prueba\winevt", "\servicio_prueba\iislog", "\servicio_prueba\applogs"
function crea_carpeta {
param($server, $carpeta)
#New-Item -ItemType directory "$server\$carpeta"
Write-Host "$server\$carpeta"
}
foreach ($server in $p_serverstq) {
foreach($carpeta in $p_carpetas) {
crea_carpeta($server, $carpeta)
}
}
i put this "write-host" and i see the function dont make correctly the route
this is the output:
\127.0.0.1\test_share\logs \servicio_prueba\winevt
\127.0.0.1\test_share\logs \servicio_prueba\iislog
\127.0.0.1\test_share\logs \servicio_prueba\applogs
\192.168.1.10\test_share\logs \servicio_prueba\winevt
\192.168.1.10\test_share\logs \servicio_prueba\iislog
\192.168.1.10\test_share\logs \servicio_prueba\applogs\
between the "...\logs" and "\servicio...." have a space i dont know how fix this.
Thanks and sorry for my bad english