I keep getting odd results with my loops
I'm checking for my flash drive named sapien
I'm checking if PowerShell Studio is running
Then continuing on.... sometimes, even if the USB drive was insterted before starting the app, will not detect it... Sometimes if PowerShell Studio is closed, it will say it's open.
Tray App no output
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.
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
Re: Tray App no output
So my thinking is this..
Line 7, if it pulls the drive letter, means it's not $null, so we can skip that. If it is $null, it stops and does this until it finds the drive
Line 7, if it pulls the drive letter, means it's not $null, so we can skip that. If it is $null, it stops and does this until it finds the drive
- #Check USB status
- Do
- {
- New-BurntToastNotification -Text "Flash Drive is not present" -AppLogo $ErrorLogo -Silent
- start-sleep -Seconds 30
- $USB
- }
- While ($USB -eq $null)
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
Re: Tray App no output
Line 7
Then in the while loop, if I put in my flash drive, it should detect that.... my thinking
Then in the while loop, if I put in my flash drive, it should detect that.... my thinking
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
Re: Tray App no output
Code: Select all
while(-not ($USB = Get-PSDrive|?{$_.Description -eq 'Sapien'})){
New-BurntToastNotification -Text "Flash Drive is not present" -AppLogo $ErrorLogo -Silent
start-sleep -Seconds 10
}