Need some assistance

I have a powershell script that installs the IIS features the application I am using needs. the script is very basic and works great except I need it to log the features that were installed or removed. The log I am generating is getting cut off and I have not been able to figure out how to format it so this does not happen.

I am just running the add-windowsfeature cmdlet and piping the results to format-list then out to a text file. This causes the feature result line to get cut off. Seems pretty basic any help?

 

Format-List is what’s doing the truncating; try removing that from your script and see what you get. If you need format-list to get entries that aren’t returned by default, try replacing it with “Select-Object *”.

You can also try adding -Wrap to Format-Table.

Thanks for the replies I have tried both and still do not have the results I am looking for.

Here are the commands I am running I removed the format-list as suggested.

 

Import-Module servermanager

Add-Windowsfeature Web-Server,web-webserver,web-common-http,web-default-doc,web-static-content,web-health,web-http-logging,web-request-monitor,web-http-tracing,web-stat-compression,web-net-ext,web-net-ext45,web-asp-net,web-asp-net45,web-mgmt-tools,web-mgmt-console,web-mgmt-compat,web-metabase,web-lgcy-mgmt-console,web-lgcy-scripting,web-wmi,web-scripting-tools,web-mgmt-service | write-output > c:\rs_ps\LT_IIS_Features_Installed_Log.txt

 

 

This is the output I get …

Success Restart Needed Exit Code Feature Result


True No Success {Application Development, ASP.NET 3.5, ASP…

 

As suggested I tried the -wrap but had to use format-table instead this outputs a bit more but not all of them. I tried both -auto -wrap and just -wrap

Import-Module servermanager

Add-Windowsfeature Web-Server,web-webserver,web-common-http,web-default-doc,web-static-content,web-health,web-http-logging,web-request-monitor,web-http-tracing,web-stat-compression,web-net-ext,web-net-ext45,web-asp-net,web-asp-net45,web-mgmt-tools,web-mgmt-console,web-mgmt-compat,web-metabase,web-lgcy-mgmt-console,web-lgcy-scripting,web-wmi,web-scripting-tools,web-mgmt-service | Ft * -auto -wrap | write-output > c:\rs_ps\LT_IIS_Features_Installed_Log.txt

 

 

This is the output I get…

Success RestartNeeded FeatureResult


True Yes {Application Development, ASP.NET 3.5, ASP.NET 4.5, Common
HTTP Features…}

 

Overall it is just not a big deal I can live without the full list it would just be nice to know how to do this in case I need to in the future.

 

thanks again

This blog post will show you how to get the format you need:

http://poshoholic.com/2010/11/11/powershell-quick-tip-creating-wide-tables-with-powershell/