Create a Progress Bar using Write-Progress for bulk New-mailboxImportRequests


i doing bulk pst imports using new-mailboximportrequest.  fyi, command used:

dir "\\pathname\*.pst" | %{ new-mailboximportrequest -name recoveredpst -batchname jpdetw -mailbox $_.basename -filepath $_.fullname  -baditemlimit 5000 -acceptlargedataloss}

i can status shown in percentage complete running:  get-mailboximportrequest -name recoveredpst | get-mailboximportrequeststatistics which outputs coulumsn name, status, targetalias, percentcomplete, have run manually ad hoc

i love make status automated message , status bar using write-progress.  add contents of percentcomplete column returned ($sumlpercentcomplete), divide number of items in column, total percentage complete ($totalpercentcomplete) mailboxes, pipe write-progress.  problem read write-progress doesnt accept inputs pipes.

if ran timed command ran every 5 seconds until totalpercentcomplete= 100 maybe work?

anyone have fun ideas on this? :-)


-- ron williams http://www.r0nwilliams.com

why insist on 1 liner(pipes)?

put write-progress loop (%{})

get *.pst | foreach {

new-mailboxrequest ...

write-progress ..

}

you can build breakpoint variable can update automatically

example (don't know if works)

set-psbreakpoint -variable sumipercentcomplete -mode read -action { 	$value = (get-mailboximportrequest -name recoveredpst | get-mailboximportrequeststatistics).percentcomplete 	set-variable -name sumipercentcomplete -value $value -option readonly, allscope -scope global -force -erroraction silentlycontinue } -erroraction silentlycontinue  



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client