Author Posts

January 1, 2012 at 12:00 am

by charles00d at 2013-03-05 18:43:38

hi everyone and mvp's 😀

i've just started using powershell and really dont know much. i have this code:

@echo off
Powershell -noexit "ipconfig /displaydns | select-string 'Record Name' | foreach-object { $_.ToString().Split(' ')[-1] } | Sort | Out-Gridview"

how do i save the output into a txt file format?

thanks

by mjolinor at 2013-03-05 18:51:13

Just trade Out-Gridview for Set-Content or Out-File:

Powershell -noexit "ipconfig /displaydns | select-string 'Record Name' | foreach-object { $_.ToString().Split(' ')[-1] } | Sort | Set-Content c:\somedir\file.txt"

by charles00d at 2013-03-05 19:02:58

thank you mjolinor you're a savior woooooooooooo 😀

by mjolinor at 2013-03-05 19:23:35

Glad to help! Come back and see us again!