im newbie in powershell but happy to explore it. I have some question currently i got sample scripts that count number of rows to a target csv file but my next job would be save it to a file either CSV or text file then send it as email attachment
I have here my 1st part which is counting rows of csv
$fileEntries = [IO.Directory]::GetFiles("\\servername\folder\folder2"); foreach($fileName in $fileEntries) { $count = 0 $filedate = (Get-Date).Date $reader = New-Object IO.StreamReader $filename while($reader.ReadLine() -ne $null){$count++} $reader.close() #Get-Content $filename | %{$lines++} [Console]::Writeline($filename+""+$count+""); }