Monday, February 15, 2016


HA, Said I was going to get better, and what did I do. I got worse.

Well I have something that’ll keep me coming back here and sharing! I’ve recently dropped about $1500.00 on some home equipment to help setup a fairly decent home lab. So you ask, “this fat balding guy” spends $1,500.00 on a home lab, what the hell did he get? Well, let me share with you, what I’ve ordered and have on the way.


I went with the Tripp Lite Model SR12UB from Home Depot (got a Home Depot card, 0% interest for 6 months!) I went with the enclosed rack, because, well I have 2 bastard cats that like to chew on cables. I’ll teach these little bastards! Also, I don’t plan on having a full 42U rack in my house, I may add 2 more servers down the raid, but a 12U rack is plenty of room.


I found an HP DL380 Gen 6 2x Xeon L5638 2Ghz Six Core w/HT, 72GB Ram and 8x300GB 10k sas drives for $648.00 shipped which includes the rails. After countless hours of searching I found this to be the best deal for the price. I plan on running 9-12 VMGuests on this system, and given this is just a home lab for learning, I believe this system will do just fine. This by no means is intended to break speed records nore will it be the slowest out there.

 


I was lucky and came across this Cisco ASA 5506-X w/FirePOWER for $404.00 shipped. Supposedly new in box, we shall see.  Well frankly whats not to like about a firewall, with active packet scanning, to keep them NASTY bugs out of my crap!

4th, the switches

I ‘m surfing for 2x Cisco 3750g’s at the time, I’ll keep you all posted on what I end up finding.

 

I’ll do my best to post pictures and configs!

Sunday, April 26, 2015

Office 365 - Password Expiring notifications version 2.0

Been a while sense my last post and i'm sorry for this. I need to get better at blogging.
However, here is version 2.0 of my Office 365 password expiration script.
Keep in mind this was written to be automated. You will need to create a "cached" user name and password. Please review one of the articles
 http://social.technet.microsoft.com/wiki/contents/articles/4546.working-with-passwords-secure-strings-and-credentials-in-windows-powershell.aspx
or
http://blogs.technet.com/b/heyscriptingguy/archive/2013/03/26/decrypt-powershell-secure-string-password.aspx
on secure string passwords.

Any questions feel free to ask away!

<#
.NOTES
===========================================================================
Created on:   3/31/2015 10:28 AM
Created by:   josh.acton
Filename:    
===========================================================================
.DESCRIPTION
version 2.0 of Office 365 password expiring.
#>

$date = get-date -Format MMddyyyy
#Make Office 365 Connection
$emailusername = "USER ACCOUNT" #Your User account
$encrypted = 'SECURE STRING HERE' | ConvertTo-SecureString #Place your secure string from text file here
Start-Transcript -path "C:\reports\Office365_Logs\O365PasswordExpire_US_$date.log" -force -NoClobber -append
$credential = New-Object System.Management.Automation.PsCredential($emailusername, $encrypted)
#$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber
Connect-MsolService –Credential $credential

$date = get-date -Format MMddyyyy

#Start-Transcript -path "C:\reports\Office365_Logs\O365PasswordExpire_US_$date.log" -IncludeInvocationHeader
#Get system Date
$CSVDate = Get-Date -Format MMddyyyy

#Sets up the CSV File to email to service-desk for passwords that are expired
$csvstart = "User,Password_last_set,Password_expired_on"
Add-Content C:\reports\O365PWExpired\BluePWExpire_$CSVDate.csv $csvstart

#Sets days of advance notice
$AdvancedWarning = "14"
$AdvancedWarning2 = "7"
$Domains = (get-msoldomain).name
ForEach ($Domain in $Domains)
 
{
$logadd = "----------------------------Reviewing $Domain Now----------------------------"
add-content "C:\reports\Office365_Logs\O365PasswordExpire_US_$date.log" $logadd
Write-Host $logadd
$PWPolicy = Get-MsolPasswordPolicy -domain $Domain
$NotificationDays = $PWPolicy.NotificationDays
$ValidityPeriod = $PWPolicy.ValidityPeriod
If ($NotificationDays -eq $null -and $ValidityPeriod -eq $null)
{
$logadd = "No policy set, applying defaults"
add-content "C:\reports\Office365_Logs\O365PasswordExpire_US_$date.log" $logadd
Write-Host $logadd

$NotificationDays = "14"
$ValidityPeriod = "90"
}
else
{

$logadd = "Policy has be set - $notificationdays and $ValidityPeriod"
add-content "C:\reports\Office365_Logs\O365PasswordExpire_US_$date.log" $logadd
Write-Host $logadd

}
$Users = (Get-MsolUser | where{ $_.UserPrincipalName -like "*$Domain" }).UserPrincipalName
foreach ($User in $Users)
{
#write-host "working on user $user"
$PWLastSet = (Get-MsolUser -UserPrincipalName $User).lastpasswordchangetimestamp
If ($PWLastSet -ne $null)
{
$PWPeriod = ($PWLastSet).adddays($ValidityPeriod)
$PWExpire = ($PWPeriod - [DateTime]::Now).days
If ($PWExpire -le 0)
{
$logadd = "$User password expired on $PWPeriod"
add-content "C:\reports\Office365_Logs\O365PasswordExpire_US_$date.log" $logadd
                Write-Host $logadd
$Content = "$User,$pwlastset,$PWPeriod"
Add-Content C:\reports\O365PWExpired\BluePWExpire_$CSVDate.csv $Content
}
Else
{
If ($PWExpire -eq $AdvancedWarning -or - $PWExpire -eq $AdvancedWarning)
{
                    #in the next line, add in your exceptions.
If ($User -eq "exception1" -or $user -eq "exception2" )
{ Write-Host User is predefined to be skipped, skipping }
else
{
write-host EXPIRING! $user password will expire on $pw180 that is $pwexpire days -ForegroundColor yellow -BackgroundColor Black
$logadd = "$user password will expire on $PWPeriod that is $pwexpire days"
add-content "C:\reports\Office365_Logs\O365PasswordExpire_US_$date.log" $logadd
$Subject = "Office 365 password for $user is going to expire!"
$Body = "$user password will expire on $PWPeriod"


Send-MailMessage -to "help@servicedesk.com" -from "email@servicedesk.com" -Subject $Subject -Body $body -SmtpServer 192.168.0.1
}
}
else
{
$logadd = "$user has $pwexpire day(s) left."
add-content "C:\reports\Office365_Logs\O365PasswordExpire_US_$date.log" $logadd
Write-Host $user has $pwexpire days left. -ForegroundColor Green
}
}
}
}
}

Send-MailMessage -to "sysadmin@servicedesk.com" -From "email@servicedesk.com" -Subject "Office 365 PW expiring has ran" -SmtpServer 192.168.0.1

Thursday, October 2, 2014

Office 365 Password expiring.


Well my first week of having this blog up has NOT been productive at all to say the least. Thought I’d have more time to do this sort of thing but turns out, maybe I was wrong? Welp, guess I have to set aside some time to make this happen.

So lets start this out on an Office 365 password expiring alerting email I created. In some smaller environments it is possible you are not using AD FS or DirSync, and I suppose some larger companies could have the same. This script goes through each user accounts and determines when their last password was set, adds 180 days (could be changed) and counts down from there on how many days the user has until their password expires. Currently the email is sent to the “Help Desk” so the agents may reach out to the customer for white glove service and assist them with their password reset. However you could change this to the $USER and have it go to the customer (your end user) if you so wish.

Enjoy!

$date = get-date -Format MMddyyyy
#Make Office 365 Connection
$emailusername = "user@domain.com"
$encrypted = 'HASH' | ConvertTo-SecureString
Start-Transcript -path "C:\reports\O365PasswordExpire_$date.log" -force -NoClobber -append
$credential = New-Object System.Management.Automation.PsCredential($emailusername, $encrypted)
#$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber
Connect-MsolService –Credential $credential
#Make local webservices connection
#Get system Date
$CSVDate = Get-Date -Format MMddyyyy
#Sets up the CSV File to email to service-desk for passwords that are expired
Add-Content C:\reports\O365PWExpire_$CSVDate.csv "User,Password_last_set,Password_expired_on"
#Sets days of advance notice
$AdvancedWarning="14"
$AdvancedWarning2 = "7"
#Begin Script
#Gets all uers from MS Online.
$MSOnline = (Get-MsolUser).UserPrincipalName
#Go through each user returned
ForEach($User in $MSOnline)
{
    $PWLastSet = (Get-MSOLUSER -UserPrincipalName $user).lastpasswordchangetimestamp
        If ($PWLastSet -ne $null)
        {
            $PW180 = ($PWlastset).Adddays(180)
            $PWExpire = ($PW180-[DateTime]::Now).Days
                IF ($PWExpire -le 0)
                {
                    Write-host $user password expired on $pw180
                    $Content = "$User,$pwlastset,$pw180"
                    Add-Content C:\reports\PWExpire_$CSVDate.csv $Content
                }
            else
                 {
                    If ($PWExpire -eq $AdvancedWarning -or $PWExpire -eq $AdvancedWarning2)
                        {
                        #####
                        # Provides exception on specific user names if you have passwords set to never expire
                                        If ($User -eq "username" -or $user -eq "username2")
                    {Write-Host User is predefined to be ignored, skipping}
                    else
                    {
                                     write-host EXPIRING! $user password will expire on $pw180 that is $pwexpire days
                            $Subject = "COMPANY - Office 365 password for $user is going to expire!"
                            $Body = "$user password will expire on $pw180"
                            #if you want the email to go to the user change "help@domain.com" to $User
                            Send-MailMessage -to "help@domain.com" -from help@domain.com -Subject $Subject -Body $body -SmtpServer "SMTPSERVER"
                    }
                    ############
                        }
            else
                {
                    Write-Host $user has $pwexpire days left.
                }
            }
        }
}
Remove-PSSession $O365Session
Stop-Transcript

 

Sunday, September 21, 2014

What have I done?!

So a few people have stated I should start a blog of my everyday life experience as a Systems Administrator. What can we expect from this blog? Welp, lets see......Not quite sure yet, maybe some labs, maybe some power shell examples, some neat stuff like that.

Some of my main interests are Power Shell scripting, System Center 2012 R2 Configuration Manager.

So lets see what turns out of this blog!