Hi All, ive created a gui, all working well however i would like a progress bar to display when running this command (unsure how to add this without a foreach & counter) when you run this in ISE or console it brings up its own progress bar within the exchange module, so im hoping to somehow transfer that. its the $result = get-mailbox...... that i want to track as we have 100's/1000's of MBs in a db
$buttonSearchAndDestroy_Click={
#TODO: Place custom script here
$this.enabled = $false
$from = $textbox1.Text
$Subject = $textbox2.Text
$database = $combobox1.Text
$User = $env:USERNAME
if ($from -and $subject -and $from -notmatch "\*")
{
try
{
$result = Get-Mailboxdatabase "EUdag1_db1" | Search-Mailbox -SearchQuery "from:$from and Subject:$subject" -DeleteContent -TargetMailbox emea-restoreditems -TargetFolder inbox -force
$result | Out-File "c:\TEMP\SDResult.txt"
Add-Content "c:\TEMP\SDResult.txt" $from
Add-Content "c:\TEMP\SDResult.txt" $Subject
$result2 = Get-Content "c:\TEMP\SDResult.txt"
Update-ListBox $listbox1 $result2 -Append
$smtpServer = "smtp.xxxxx.com"
$From1 = "Search-and-Destroy@xxxxx.com"
$SubjectCPY = "Search and Destroy App Used By $User"
$Body = "Attached is the result of the search initiated & items destroyed, Criteria of search is last 2 lines of file"
$prior = "mark.prior@xxxxx.com"
#Email Content
## -cc $mail will mail user account
Send-Mailmessage -smtpServer $smtpServer -from $from1 -to $prior -subject $subjectCPY -priority High -Body $Body -BodyAsHtml -Attachments "c:\TEMP\SDResult.txt"
sleep -Seconds 3
del "c:\TEMP\SDResult.txt"
}
catch
{
$test = "Something Went Wrong, Please Process Manually"
Update-Listbox $listbox1 $test
}
}
Else
{
$test = "From or Subject Field Empty"
$test2 = "Wilcards (*) Cannot Be Used In From Field"
Update-Listbox $listbox1 $test
Update-Listbox $listbox1 $test2 -Append
}
$this.enabled = $true
}
$progressbar1_Click={
#TODO: Place custom script here
}
Attach A progress bar
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Attach A progress bar
Hi Jvierra
ive tried, and it does not appear, just a frozen looking window until its complete
ive tried, and it does not appear, just a frozen looking window until its complete
Re: Attach A progress bar
This is where im stuck , never used this before, if i can get an example applied to the above im sure i will be able to modify for any other programs
Re: Attach A progress bar
thanks, already took a look and tried to apply but still no fruits
will continue on with it
will continue on with it