I have this code that I found online. I copy it into PowerShell ISE. I get the squiggle red line under 2 of my brackets { see below. How come and how do I make this work?
Function get-pwdset{ << This bracket has the red line under it
Param([parameter(Mandatory=$true)][string]$user)
The next section of the function will define a variable to hold an Active Directory user object with specified properties for passwordneverexpires and passwordlastset.
$use = get-aduser $user -properties passwordlastset,passwordneverexpires
If($use.passwordneverexpires -eq $true)
{
write-host $user "last set their password on " $use.passwordlastset "this account has a non-expiring password" -foregroundcolor yellow
}
Else
{ << This bracket has the red line under it
$til = (([datetime]::FromFileTime((get-aduser $user -properties "msDS-UserPasswordExpiryTimeComputed")."msDS-UserPasswordExpiryTimeComputed"))-(get-date)).days
if($til -lt "5")
{
write-host $user "last set their password on " $use.passwordlastset "it will expire again in " $til " days" -foregroundcolor red
}
else
{
write-host $user "last set their password on " $use.passwordlastset "it will expire again in " $til " days" -foregroundcolor green
}