Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

i want the output of my powershell in excel file

$
0
0

Hello every body!

i made this program :

do{

$ServerName = Import-Csv -Path "C:\Desktop\importer0.csv"

$ping= new-object System.Net.NetworkInformation.Ping

$objExcel = new-object -comobject excel.application

$objExcel.visible = $false

$datex= get-date -format ddMMyyyy

$Path="C:\Users\mallee\Desktop\test_excel\ping_$datex.xlsx"

$repond=""

$repondpas=""

Foreach ($IP in $ServerName){

$IP0=((($IP.adresIP).substring(1,14)).replace('.0','.')).replace('.0','.') "

$reply=$ping.Send($IP0)

Try{

$Info=[System.Net.Dns]::GetHostentry($IP0)

$Name=$Info.HostName

$DATE=get-date

}

Catch{

$Name = "inconnu"

#Write-Host $_

$DATE=get-date

}

if ($reply.status –eq “Success”){

$reponse="repond"

$repond +=" $IP0 ;$Name ;$reponse ;$DATE ""`n"

}

else{

#$repondpas =""

#$repondpas=";"

$reponse="ne repond pas"

$repondpas += “$IP0 ;$Name...


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>