header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Outputting All Information Problem
Last Post 19 Sep 2008 01:29 PM by Shay. 6 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SynJunkieUser is Offline
New Member
New Member
Posts:97
Avatar

--
19 Sep 2008 10:56 AM  

Hi

I'm creating a script that I can run against a remote host that may have been comprimised so I can compare it against a baseline.

 

The types of commands i'll be issuing will be:

gwmi win32_Service | Select Name,ProcessID,State,StartMode,PathName | ft >C:\outputfile.txt

 

What I really need to know is, is there a way that I can get the output to not truncate?  I have used the -auto and -wrap options but what I would prefer is to have the entire output on one line as these are not that readable for pathnames especially.

I have been trying to get the out-file -width option to work but it uses the extended width setting for all columns.  Any help or ideas would be appreciated.

Regards

Lee

ShayUser is Offline
Basic Member
Basic Member
Posts:281
Avatar

--
19 Sep 2008 11:11 AM  
You can try format-list or export-csv instead.
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
SynJunkieUser is Offline
New Member
New Member
Posts:97
Avatar

--
19 Sep 2008 11:29 AM  

Thanks Shay. 

The only issue with those is, format-list will not be as readable as as a table for things like services and processes, and export-csv gets a little screwed up when I append different things to the same file, again such as processes, services, software and reg keys etc...

is there a way to output straight to text to maintain the table formating from the screen and use the -width option or similar but then not have it apply to spaces?

 

 

ShayUser is Offline
Basic Member
Basic Member
Posts:281
Avatar

--
19 Sep 2008 12:31 PM  
Not one that I aware of.
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
SynJunkieUser is Offline
New Member
New Member
Posts:97
Avatar

--
19 Sep 2008 01:13 PM  
Thanks Shay. If I find a work around i'll post it up.
SynJunkieUser is Offline
New Member
New Member
Posts:97
Avatar

--
19 Sep 2008 01:25 PM  
Okay, I got it. I should have tried more combinations of the -auto and -width before posting, but here is my solution.


gwmi win32_Service | Select Name,ProcessID,State,StartMode,PathName | ft -auto | outfile - width 150 C:\testfile.txt


it seems that the -auto will size columns that need to be sized and -width will use the specified width if it needs to use it.
ShayUser is Offline
Basic Member
Basic Member
Posts:281
Avatar

--
19 Sep 2008 01:29 PM  
Glad you worked it oiut :-)
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer