He echo el siguiente script, que crea una carpeta, tira un ping, crea un archivo de texto y guarda el resultado en el archivo, lo almaceno con variables, el tema es que guarda el resultado en una sola línea y no como el formato de salida en pantalla:
hostname
$nombre = hostname;
New-Item \\Shares\Comun\Buscador\Ping\$nombre -Type Directory
$cadena1 = ping 23.81.246.84;
$cadena2 = ping 23.227.190.216;
$cadena3 = ping 37.72.172.110;
$final = $nombre+"`n"+$cadena1+"`n"+ $cadena2+"`n"+$cadena3
$final| Out-File \\Shares\Comun\Buscador\Ping\$nombre\$nombre.txt
Salida
Pinging 23.81.246.84 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 23.81.246.84: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Pinging 23.227.190.216 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 23.227.190.216: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Pinging 37.72.172.110 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 37.72.172.110: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)