Export Inactive users based on Domain and Last Logon Time

# Gets time stamps for all User in the domain that have NOT logged in since after specified date import-module activedirectory $domain = “Domain” $DaysInactive = 90 $time = (Get-Date).Adddays(-($DaysInactive)) # Get all AD User with lastLogonTimestamp less than our time and set to enable Get-ADUser -Filter {LastLogonTimeStamp -lt $time -and enabled -eq $true} -Properties […]

Re Importing an In-Place Archive into a Mailbox

Make sure there is enough space in the mailbox to accommodate the import First we need to apply the correct permissions to the admin completing the work. New-ManagementRoleAssignment -Role “Mailbox Import Export” –User “Rob Ackers” Next we need to export the Archive mailbox New-MailboxExportRequest –Mailbox “Rob Ackers” -IsArchive -FilePath “\\SharePath\Rob Ackers Archive.pst” I would also […]

Sending Emails from Powershell

$SMTPServer = “SMTP Server Details” $SMTPPort = “25/587” $Username = “Email of login account” $Password = “***”   $to = “Email” $cc = “” $subject = “Results for AD Report LAST LOGON” $body = “Script version 1.0 by Maarten Mol”   $message = New-Object System.Net.Mail.MailMessage $message.subject = $subject $message.body = $body $message.to.add($to) $message.cc.add($cc) $message.from = […]