Reputation
404
Top tag
Next privilege 500 Rep.
Access review queues
Badges
1 12 25
Newest
 Yearling
Impact
~32k people reached

May
13
awarded  Caucus
Apr
17
awarded  Popular Question
Feb
26
awarded  Informed
Feb
8
reviewed Reviewed Global VPN Client Can't Acquire IP Address
Feb
8
reviewed Reviewed Linux: serial port forwarding via RDP to Windows machine
Feb
7
awarded  Custodian
Jan
10
awarded  Fanatic
Dec
26
accepted VLAN security compared to DMZ
Dec
25
asked VLAN security compared to DMZ
Dec
13
accepted Protect foreach loop when empty list
Dec
13
comment Protect foreach loop when empty list
I've used the first one (it's easier to understand), I couldn't get the second one to work (I was probably doing something wrong).
Dec
13
comment Protect foreach loop when empty list
@Dan - Doh, can't believe I didn't spot that, thanks.
Dec
13
answered Protect foreach loop when empty list
Dec
13
comment Protect foreach loop when empty list
@Dan - Tried both ($backups > 0) and (@($backups).count -gt 0), but neither work as expected when there are no files.
Dec
13
comment Protect foreach loop when empty list
$count = @($backups).count; almost works, but when there are no files if f($count -gt 0) is true!
Dec
13
comment Protect foreach loop when empty list
Adding if ($backups.count -gt 0) stops the loop executing even when there's 1 item in $backups. $backups.count even on it's own doesn't output anything.
Dec
13
asked Protect foreach loop when empty list
Dec
12
accepted Powershell enters foreach loop with null object
Dec
12
comment Powershell enters foreach loop with null object
It appears that I'm only running v2 (I used $psversiontable), I feel an upgrade coming on :) Thanks for your help.
Dec
11
comment Powershell enters foreach loop with null object
Yes, I am using PowerGUI. My powershell.exe in WindowsPowerShell/v1.0 is 6.1.7600.16385. $PSVersionTable gives CLRVersion: 4.0.30319.17929 and WSManStackVersion: 2.0