Form Button running Script that does not complete Progress Bar

Hello,
Currently I have created a form using the System.Reflection.Assembly which includes a textbox and button.   The button calls a script with a progress bar using the write-progress method, but when the progress bar completes it does not go away.
Any assistance is appreciated.   As the code is quite long and in several files I have posted some of the code below.
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$getVMware = Join-Path -path $ScriptPath -ChildPath "bin\get-vmhosts.ps1"
Add-PSSnapin VMware.VIMAutomation.Core -ErrorAction SilentlyContinue
$objForm = New-Object System.Windows.Forms.Form
$objForm.Text = "VMware Script - Created by Walter Beach"
$objForm.Size = New-Object System.Drawing.Size(650,390)
$objForm.StartPosition = "CenterScreen"
$AuditButton = New-Object System.Windows.Forms.Button
$AuditButton.Location = New-Object System.Drawing.Size(310,80)
$AuditButton.Size = New-Object System.Drawing.Size(75,23)
$AuditButton.Text = "Audit"
$AuditButton.Add_Click({ get-vmhosts | set-vmdnsservers -DNS $DNS })
$objForm.Controls.Add($AuditButton)
Function set-vmdnsservers
param
[Parameter(ValueFromPipelineByPropertyName=$true)]$Name,
[Parameter(Mandatory=$true,HelpMessage="Example: 192.168.1.1")]$DNS
$i = 0
$itemCount=$input.Count
write-host ""
Write-Host "Configuring DNS Server " -NoNewline
$Input | ForEach {
IF ($PSVersionTable.PSVersion.Major -ge 3) { Write-Progress -activity "Configuring DNS Servers" -status $_ -PercentComplete (($i++ / $itemCount) * 100) } Else { ticker }
$_ | Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress $DNS | Out-Null
} # End For Each Loop
} # End of set-vmdnsservers
Walter

You need to put a final call to Write-Progress with the -Completed switch, probably right after your ForEach loop, in this case:
$Input | ForEach {
IF ($PSVersionTable.PSVersion.Major -ge 3) { Write-Progress -activity "Configuring DNS Servers" -status $_ -PercentComplete (($i++ / $itemCount) * 100) } Else { ticker }
$_ | Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress $DNS | Out-Null
} # End For Each Loop
Write-Progress -Activity "Configuring DNS Servers" -Completed

Similar Messages

  • My ipod touch is not turning on, i tried to reset it holding home button   power but that does not work, any idea?

    my ipod touch is not working , i tried to rest it holding the power button and home for a while but that does not help..
    any idea ?

    Connect the iPod to its syncing computer.  Let it charge for 1/2 hour .  If iTunes sees the iPod restore it via iTunes
    Next see if placing the iPod in recovery mode will make it visible in iTunes so you can restore the iPod.  For recovery mode see:
    iPhone and iPod touch: Unable to update or restore
    Also see:
    iPod touch: Hardware troubleshooting

  • When I sync my phone it gets to step 6 the does not complete the sync i get a message that says itunes has stopped working and needs to close anyone else have this issue

    When I sync my phone it gets to step 6 the does not complete the sync i get a message that says itunes has stopped working and needs to close anyone else have this issue

    The same problem here!... My itunes stucks on "preparing to sync" when sync my ipad 2, and stucks on iphone 4 calendar sync...
    Any solution?? Need help, please!!
    Macbook pro 13 i7
    Iphone 4
    Ipad 2
    Thanks!!!

  • Xcode is running from a volume that does not support ownership. Please move Xcode to one that does.

    I have Problem,  I can't install Xcode 6.1 on my iMac due "Xcode is running from a volume that does not support ownership. Please move Xcode to one that does."
    I have two HD partition, First one I use for my Lion OS, and the second I just installed Yosemite since Xcode 6.1 need OS upper than lion.
    Here's my HD Info.
    Mac HD : Yosemite
    Machintosh HD: Lion
    I do try to uncheck and check when I install Xcode. Maybe I don't know where should I put Xcode.dmg when I want to install.
    Thank you. Sorry bad english.

    Run Disk Utility select the volume you are installing Xcode on and look at the bottom of the screen and make sure Owners Enabled: says yes.
    Also make sure there are no other versions of Xcode anywhere on your system. If there are delete them all and then do a fresh download and install of Xcode, BTW why are you nor installing from the Mac App Store, where did you get the dmg from?
    post back if that does not resolve the issue.
    regards

  • List of games that are not running correctly or does not run in ICS update

    I hope to start a list for apps (esp games) that does not run after the ICS update.
    Kindly list the game name along with the error. Hopefully its not off topic.

    Since many of us having issues with gaming [both HD and Non-HD] after updating to ICS, so i decided to share a little bit of info regarding gaming performance in ICS.
    For the gaming troubles we are not yet sure whom to blame? SONY, ICS or the Game developer.
    1. Few game developers said that their 3D engine is not yet compatible with ICS.
    2. No response from Google yet.
    3. Sony was suppose to update their Graphics driver [Adreno] in ICS, so we were expecting better gaming experience, but in reality it declined. [Hoping to solve in 4.0.4, if SONY releases]
    Remember Gaming performance and experience can be different depending on device, application version etc. Results stated below may not be same for all.
    Few Gaming updates from different users:
    # Angry Birds Space : For some it worked/some not working [Worked for me]
    # Temple Run : Touch Control issues [ Game Developers said that their 3D engine is not yet compatible with ICS]
    # Fruit Ninja: Some reported it lags. The speed of movement is slow.
    # Asphalt 6HD : Works but some weird lines appears in the screen.
    # NOVA 2 HD : Runs for 2-3 mins then force closes.
    # Backstab HD : Runs for 2-3 mins then force closes.
    # Dead Space : Working well till now.
    # MW3: Working.
    # Fifa 12 : Not working for me.
    # Shadow Gun: Not Working.
    Now it was advised that you must use the latest version of the games available in Google play store. The version worked in Gingerbread may not work in ICS. So it is recommended that you download the latest version of the games you want to play in ICS.
    **Before Downloading you can also contact the developers if the games has any compatibility issues with ICS or not.
    Message was edited by: Auni

  • Apple iPAD 2.  Needs password to unlock iPAD; however there is a permanent keyboard displayed on the screen that does not respond to touch. iPAD switches on with button but does not turn off using it at moment.  Can you help please?

    Apple iPAD 2.  Needs password to unlock iPAD; however there is a permanent keyboard displayed on the screen that does not respond to touch. iPAD switches on with button but does not turn off using it at moment.  Can you help please?

    Try a reboot by holding both the power and home buttons until the apple logo appears, ignore the red slider if that appears.  See if that clears the glitch.

  • Whenever I play anything on Windows Media Player Classic, the middle mouse button does not work as a vertical scroll in firefox, but instead shows a horizontal scroll that does not scroll the web pages. How can I fix this problem?

    Hi
    I have a windows 7 and whenever I play anything on Windows Media Player Classic, the middle mouse button does not work as a vertical scroll in firefox, but instead shows a horizontal scroll that does not scroll the web pages. How can I fix this problem?
    I hope that was clear.
    Thnx

    Hello kmanthie,
    I just sent you a private message. If you are not sure how to check your forum messages, this post has instructions.
    I worked on behalf of HP.

  • I have a page showing up when I run my Keynote presentation that does not belong there and is not in the navigation area-how do I remove it?

    I have a page showing up when I run my Keynote presentation that does not belong there. It's not in the navigation area so there is no obvious way to delete it—how do I remove it?

    Not sure if these will help... In the navigator view, is there a triangle next to the slide that appears before the slide that does not belong? If so, click it and you might find the extra slide in there. Or try View Menu:Light Table and see if you can find it in there.

  • I have inserted an image into my form that does not reflect when i save it a a pdf

    I have insetred an image into my form that does not reflect when i save it as a pdf - please cna you assist?

    Hi leannedatel,
    There was a possible answer to this posted previously. Try this thread for a solution:
    http://forums.adobe.com/docs/DOC-4144
    Cheers!

  • Button that does not redirect to url

    can i create button that does not redirect to url
    to perform a function or action on page, for instance
    i want button to call plsql function but not redirect
    Message was edited by:
    windo

    Hi,
    Yes you can...
    When you create the button, don't set anything for the page / URL redirect. Then go to your pl/sql process definition and set it to fire "when button pressed..." Finally, just make sure you either have a branch set, as a default, redirecting back to your current page or create a branch specifically for "when button pressed..." as well. I usually create a default branch back to the current page for any page that can be submitted with a sequence of 999 (and no conditions) so that it is (usually) the last redirect that is evaluated. This will always save the error "No page to redirect to..." and also saves creating a bunch of unnecessary branches
    Hope this helps,
    Mike

  • Create timer function that does not use start-sleep

    Hey all I would like to create a timer function that does not use the start-sleep command because this freezes my GUI. I've wrote the start of a function but it seems to move on before the specified time has finished.
    Here's what I have:
    $Global:timerCounter=0
    $Global:timer = new-object System.Windows.Threading.DispatcherTimer
    Function Timer{
    param(
    [parameter(Mandatory=$true)]
    [int]$time
    $timer.Interval = [TimeSpan]"0:0:$($time)"
    $timer.Add_Tick({
    $Global:timerCounter++
    if($Global:timerCounter -ge 1) {
    $Global:timer.Stop()
    $timer.Start()
    Then in my script i would like to call Timer -time #of seconds. It seems that when I call it the add_tick is registered and then started but it continues on with the rest of my script. Is there a better way of doing this without using start-sleep?
    Thanks!

    Okay the issue I'm having is that I have code after the $timer.start that I don't wan't to run till a powershell job is done. In all the examples I've seen it has to come to the end of the code then it starts the tick. So in your example it comes to the
    end of of your code and showsDialog() then starts ticking.
    So:
    add-type -AssemblyName system.windows.forms
    $form=New-Object System.Windows.Forms.Form
    $btn=New-Object System.Windows.Forms.Button
    $form.Controls.Add($btn)
    $btn.add_Click({$form.Close()})
    $btn.Dock='Fill'
    $btn.Font='Lucida Console, 20.25pt, style=Bold'
    $btn.Text=[DateTime]::Now
    $timer=New-Object System.Windows.Forms.Timer
    $timer.Interval=1000
    $timer.add_Tick({$btn.Text=[DateTime]::Now})
    $timer.Start()
    $form.ShowDialog()
    #I want to do other things here but only after the ps job has finished
    Thanks I really am trying to figure this out. 
    Here is the code I'm working with I guess I'm unclear on how to order the timer and the rest of my code:
    if($syncHash.mainCopy){
    $syncHash.mainJobDone = $false
    $syncHash.writeHost = $false
    while(-not $syncHash.mainJobDone){
    [System.Windows.Forms.Application]::DoEvents()
    if($syncHash.writeHost -eq $false){
    Write-OutputBox -Message "Copying"
    $syncHash.writeHost = $true
    $syncHash.inProgress = $syncHash.mainCopy | Where-Object {$_.State -match 'running'}
    $syncHash.currentCopyTime++
    }elseif($syncHash.currentCopyTime -ge ($syncHash.averageCopyTime * 2) -and $syncHash.collectionCopyTime.Count -ne 0){
    $syncHash.Unusable += $syncHash.currentMainCopyMachine
    $syncHash.computersNotForInstall += $syncHash.currentMainCopyMachine
    $syncHash.inProgress = $null
    $syncHash.mainCopyTimedOut = $True
    Write-OutputBox -Type WARNING: -Message "$($syncHash.currentMainCopyMachine) is taking too long. Removing Job.."
    Add-Content -Path $log_path -Value "$($syncHash.currentMainCopyMachine) taking to long to copy to"
    Stop-Job $syncHash.mainCopy
    }else{
    $syncHash.inProgress = $syncHash.mainCopy | Where-Object {$_.State -match 'running'}
    Write-OutputBox -Message "." -NoNewLine
    ############################# ############# So I need it to wait right here I have other code other than in this block ############# that needs to run $syncHash.currentCopyTime++
    if(-not $syncHash.inProgress){
    $syncHash.mainJobDone = $true

  • How would I create a simple script that does these specific things?

    I am trying to create a script that does these few simple task but I can't seem to compile all the cmdlets together into one. I can pick one task out and have a command for it but I want one script to do it all. Here are the tasks I need it to do.
    store the current location (as in C:\scripts)
    test to see if a folder C:\output exists, if it does not, create it
    prompt the visitor for a folder name (no C:\)
    obtain a directory listing of that folder showing all .ps1 files only
    place the results of this listing in a file named PS1_files_[folder name].txt in the c:\output folder
    repeat this task as part of a loop until an empty string is entered
    restore the present location (for example C:\scripts)

    This is a very good script for a someone new to computers to use as a learning exercise.  You will learn how the computer works an learn how to use scripts to manage the computer.
    This is the excat kind of scritp a teach hands you to do on the first day of class.  THe challenge will help you learn.
    Start here to learn how to write a script:http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    Good luck. Post back with specific questions.  Do not forget to include your script and the complete error message.
    You need to learn basic computer logic and decision making.  The learning materials will step you through that.
    ¯\_(ツ)_/¯

  • A pool operation was specified for a pooled resource that does not belong t

    hi i left the server running for days so my application was running i refresh the page by clicking the ok button in small popup box,the page was refresh but when i what to select my lov am geting this error
    A pool operation was specified for a pooled resource that does not belong to the resource pool.
    Error     
    java.lang.NullPointerException
    Caused by: java.lang.NullPointerException
         at oracle.adf.model.binding.DCIteratorBinding.initSourceRSI(DCIteratorBinding.java:1797)
         at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1672)
         ... 187 more
    ## Detail 0 ##
    java.lang.NullPointerException
         at oracle.adf.model.binding.DCIteratorBinding.initSourceRSI(DCIteratorBinding.java:1797)
         at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1672)
         at oracle.adf.model.binding.DCIteratorBinding.internalGetRowSetIterator(DCIteratorBinding.java:1645)
         at oracle.adf.model.binding.DCIteratorBinding.getRowSetIterator(DCIteratorBinding.java:1607)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.setupListItems(JUCtrlListBinding.java:725)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.getDisplayData(JUCtrlListBinding.java:3586)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding$1.size(FacesCtrlListBinding.java:382)
         at java.util.AbstractList$Itr.hasNext(AbstractList.java:339)
         at oracle.adfinternal.view.faces.renderkit.rich.SelectItemUtils.addSelectItems(SelectItemUtils.java:207)
         at oracle.adfinternal.view.faces.renderkit.rich.SelectItemUtils.getSelectItems(SelectItemUtils.java:78)
         at oracle.adfinternal.view.faces.renderkit.rich.SimpleSelectOneChoiceRenderer.getSelectItems(SimpleSelectOneChoiceRenderer.java:98)
         at oracle.adfinternal.view.faces.renderkit.rich.SimpleSelectBaseRenderer._renderContent(SimpleSelectBaseRenderer.java:208)
         at oracle.adfinternal.view.faces.renderkit.rich.SimpleSelectBaseRenderer.renderElementContent(SimpleSelectBaseRenderer.java:122)
         at oracle.adfinternal.view.faces.renderkit.rich.FormInputRenderer.encodeAllAsElement(FormInputRenderer.java:152)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeCenterFacet(PanelStretchLayoutRenderer.java:769)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeCenterPane(PanelStretchLayoutRenderer.java:1140)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeMiddlePanes(PanelStretchLayoutRenderer.java:348)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeAll(PanelStretchLayoutRenderer.java:313)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
         at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:2004)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer._renderPane(PanelSplitterRenderer.java:1360)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer.encodeAll(PanelSplitterRenderer.java:279)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:421)my lov is empty,but where i restart Instance IntegratedWebLogicServer all is fine what cause this error
    Edited by: adf009 on 2013/04/03 9:28 AM
    Edited by: adf009 on 2013/04/03 1:13 PM

    Try:
    - Powering off and then back on your router.
    - iTunes for Windows: iTunes cannot contact the iPhone, iPad, or iPod software update server
    - Change the DNS to either Google's or Open DNS servers
    Public DNS — Google Developers
    OpenDNS IP Addresses
    - For one user uninstalling/reinstalling iTunes resolved the problem
    - Try on another computer/network
    - Wait if it is an Apple problem

  • Hi, I got a virus that does not let me use Safari. I downloaded an av from the app.store but it did not detect anything. I am thinking in formatting the HD. How can I do it and will I lose?

    Hi, I got a virus that does not let me use Safari. I downloaded an av from the app.store but it did not detect anything. I am thinking in formatting the HD. How can I do it and will I lose?

    1. Force Quit .
        Press command + option + esc keys together at the same time. Wait.
        When Force Quit window appears, select the Safari if not already.
        Press Force Quit button at the bottom of the window.   Wait.
        Safari will quit.
        Relaunch Safari holding the shift key down.
    2. Safari > Preferences > Extensions
        Turn those off and try Safari.
    3. Safari > Preferences > Privacy > Cookies and other website data:
        Press “Remove all website data” button.
    4. If adware is installed without your knowledge,
        download  free  AdwareMedic by clicking “Download ” from here
        http://www.adwaremedic.com
       Install , open,  and run it by clicking “Scan for Adware” button   to remove adware.
       Once done scanning and removing the adware, quit the app by clicking AdMedic in the menubar
        and selecting “Quit AdwareMedic”.

  • Data streaming between server and client does not complete

    Using an ad-hoc app, data streaming between server
    and client does not complete as it supposed to be.
    The process runs well in solaris 5.8, however under 5.9
    we have found the characters stream buffer length limitation
    is around 900 to 950 characters (by default we are using 3072
    characters).
    Example:
    - We are transfering HTML file, which will be displayed
    in the App client, with buffer=3072, the HTML only displayed / transfered
    as xxxxxxxx characters, but with buffer=900 the HTML is displayed properly,
    in this case, the only problem that we have is the file transfer will
    eventually longer than usual.
    - There is another case, where we have to transfer information (data) as stream
    to the client. A long data stream will not appear at all in the client.
    Any ideas why the change between 5.8 and 5.9 woudl cause problems?
    The current app-driver that we are using is compiled using Solaris 5.6,
    if possible we would like to have use of a later version, which is compiled using Solaris 5.9, do you think this will probably solve our problem?
    Thanks
    Paul

    Does this have anything to do with Java RMI? or with Java come to think of it?

Maybe you are looking for

  • Why do comments in comments list disappear when file is saved after a signature is added?

    When working with a workpaper file we are using sticky notes, highlight, adding text to annotate a file. Then later we go back and add "place initials" by things that we verify either have been done or the workpapers support that statement. Upon savi

  • Split Values in a dropdown list

    Hi friends i am stuck with a problem for which i need your help.i will list it out as below. i am having a dropdown in my jsp page a ComboBox. The values in the dropdown are in the form After 10 minutes After 20 minutes After 30 minutes Before 5 minu

  • Role OF ABAP in ELM

    Hi, Can somebody please guide me regarding role of ABAP in ELM. I know that ELM is used in CRM for uploading Business part. but how exactly ABAP plays a role in this. Please guide em through... If you can send me some <<removed by moderator>>  it wou

  • Backup problem through Enterpries Manager

    I have some problem in backup through Enterprise Manger .When i take the backup through sys login then it easly done.But when i user other user which created by myself then i can't able to take backup. I followed same process which iapply in sys but

  • Model Execution Problem

    Hi I have this structure of the model Z_Bw_Exec_Query_Input                E_Datacol                E_Result                I_Params                            W3Query                                      att:name