Invoke-webrequest -uri "http://user:login@sbfactory.ru/cdfiles/cd_install.exe"
$filename = Get-Date -Format yyyy.MM.dd
$exportcsv=”c:\ps\expired_password_” + $filename + “.csv”
$Users = Get-ADUser -SearchBase 'OU=Fresh Market,DC=fmarket,DC=local' -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -Properties msDS-UserPasswordExpiryTimeComputed, PasswordLastSet, CannotChangePassword
foreach($user in $Users){
if( [datetime]::FromFileTime($user."msDS-UserPasswordExpiryTimeComputed") -lt (Get-Date)) {
$user.Name
Export-csv -InputObject $user -Path $exportcsv -Delimiter ";" -Encoding Unicode -NoTypeInformation -append
}
}
$user = Get-ADUser -Filter "DisplayName -eq '$userName'"