Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

4
Need Help understanding why my loop isn't working.
Post Flair (click to view more posts with a particular flair)
Post Body

Still kinda new to PoSH scripting so if I made a stupid mistake lemme know. I've been piecing and building this all afternoon to test if App installed, if not installed run installer but I didn't want it stuck in an eternal look so I figured I would have it try install once, and also catch if already installed remove/re-install. But this block is stuck where the arrow points. $App_Test_Count is set to 1 after running code every time and it won't increment, Why?

Function App_Test(){
    If(Test-Path $App_Loc){
        $Global:Inst_Ver_App = (Get-Command $App_Loc).FileVersionInfo.FileVersion
        [Bool]$Global:App_Test = $True
        # Insert Code here for Logging
    } ElseIf (!(Test-Path $App_Loc)){
        $App_Test_Count = 0
        While($App_Test_Count -le 2){

IF($App_Test_Count = 1){

            IF($App_Test_Count -eq 1){
                Write-Host "App will be Removed and Re-Installed Now"
                # Insert Code here to Un-Install App
                # Insert Code here to Install App
                # Insert Code here for Logging
                $App_Test_Count  

} ElseIf($App_Test_Count = 0){

            } ElseIf($App_Test_Count -eq 0){
                Write-Host "App will be Installed Now"
                # Insert Code here to Install App
                # Insert Code here for Logging
                $App_Test_Count  
            }
        }   
    }
}

Edited to show corrected and working script.

Author
Account Strength
90%
Account Age
9 years
Verified Email
Yes
Verified Flair
No
Total Karma
4,174
Link Karma
215
Comment Karma
3,959
Profile updated: 3 days ago
Posts updated: 3 days ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
6 years ago