Output Screen warnings


perhaps simple question

i'm running power shell command -whatif parameter on serveral thousand objects. screen scrolls see various warnings. i'd output warnings further review. how output warnings log file?

thx

that's not simple question.  is, assuming trying capture someting write-warning produce.  there feature request can vote include ability redirect :

https://connect.microsoft.com/powershell/feedback/details/297055/capture-warning-verbose-debug-and-host-output-via-alternate-streams?wa=wsignin1.0

the workaround call cmd.exe /c , redirect output there:

cmd /c powershell.exe -file 'c:\writewarning.ps1' > c:\output.txt

this assumes writewarning.ps1 file has line has this:

write-warning "blah"

alternatively you can use start-transcript if running on supported os transcripts.


http://twitter.com/toenuff
write-host ((0..56)|%{if (($_+1)%3 -eq 0){[char][int]("116111101110117102102064103109097105108046099111109"[($_-2)..$_] -join "")}}) -separator ""


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL