Mark Minasi's Tech Forum
Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment   Page 2 of 2      Prev   1   2
JeffHicks

Avatar / Picture

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 35
Reply with quote  #16 
The legacy approach with WMI has a bit of overhead which is why it is slower than using CIM, even with the DCOM protocol. In a future version, if you really want to show your PowerShell chops, use Write-Progress instead of Write-Host. Or turn the Write-Host commands into Write-Verbose.
__________________
Jeff Hicks Author ~ Trainer ~ Guru
Cloud and Datacenter Management MVP



0
jsclmedave

Administrator
Registered:
Posts: 494
Reply with quote  #17 
Dang!   You're absolutely right about the puppy killing Write-Host

I was using a Yellow Font so that I could see it better (which you cannot do without write-host) and failed to switch to Write-Output.

That is a great catch that I will update.

Write-Progress..?  By the time a progress bar would appear its already completed its task...  I also thought that Get-Progress could cause a huge slowdown on the overall script?

That can be another topic...  [smile]

Jeff is right!  Do not use Write-Host..!   Or if you do on a temp basis make sure you remove it for the final release...

__________________
Tim Bolton @jsclmedave
Email: [string](0..20|%{[char][int](32+('527377347976847978324785847679797514357977').substring(($_*2),2))}) -replace ' '  

New to the forum? Please Read this
0
JeffHicks

Avatar / Picture

New Friend (or an Old Friend who Built a New Account)
Registered:
Posts: 35
Reply with quote  #18 
This is a general response not specific to Tim's script: I don't have an issue with Write-Host if you are using it for progress or status messages. In these situations use a foreground or background color to differentiate from any actual output. But if you have a lot of status messages, consider using Write-Progress. Or if you only sometimes needs status messages use Write-Verbose.
__________________
Jeff Hicks Author ~ Trainer ~ Guru
Cloud and Datacenter Management MVP



0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.