Friday, July 25, 2014

Happy Sys Admin Day!

Star Wars Theme Song with PowerShell


In celebration of Sys Admin Day I bring to you the Star Wars theme song via PowerShell!

Enjoy!


[console]::beep(440,500)       
[console]::beep(440,500) 
[console]::beep(440,500)        
[console]::beep(349,350)        
[console]::beep(523,150)        
[console]::beep(440,500)        
[console]::beep(349,350)        
[console]::beep(523,150)        
[console]::beep(440,1000) 
[console]::beep(659,500)        
[console]::beep(659,500)        
[console]::beep(659,500)        
[console]::beep(698,350)        
[console]::beep(523,150)        
[console]::beep(415,500)        
[console]::beep(349,350)        
[console]::beep(523,150)        
[console]::beep(440,1000)



Oh and don't forget to buy your Sys Admin a beer.



All Sys Admins Like beer! 

Tuesday, July 8, 2014

Super Mario Theme Song with PowerShell

Here's a little PowerShell script that plays the Super Mario Theme Song!!
I hope you enjoy this as much as I enjoyed making it!!
<##Super Mario Intro ##>
$i = 1
do {$i++
        [console]::beep(659,250) ## E
        [console]::beep(659,250) ## E
        [console]::beep(659,300) ## E
        [console]::beep(523,250) ## C
        [console]::beep(659,250) ## E
        [console]::beep(784,300) ## G
        [console]::beep(392,300) ## G
        [console]::beep(523,275) ## C
        [console]::beep(392,275) ## G
        [console]::beep(330,275) ## E
        [console]::beep(440,250) ## A
        [console]::beep(494,250) ## B
        [console]::beep(466,275) ## A
        [console]::beep(440,275) ## A
        [console]::beep(392,275) ## G
        [console]::beep(659,250) ## E
        [console]::beep(784,250) ## G
        [console]::beep(880,275) ## A
        [console]::beep(698,275) ## F
        [console]::beep(784,225) ## G
        [console]::beep(659,250) ## E
        [console]::beep(523,250) ## C
        [console]::beep(587,225) ## D
        [console]::beep(494,225) ## B
   }until ($i -gt 1)

Modify multiple Active Directory Accounts with PowerShell

Has you company recently moved to a new location? If so here is a script to modify the "StreetAddress" Active Directory attribute for multiple users at once.
Import-Module ActiveDirectory
 $users = $i = $null
 $users = Get-ADUser -filter * -property StreetAddress
 ForEach($user in $users)
  {
   if([string]::isNullOrEmpty($user.StreetAddress))
    {  
      "modifying $($user.name)"
      Set-ADUser -Identity $user.distinguishedName -StreetAddress "1600 Pennsylvania Ave NW"
      $i++
    }  
 }  

This could be used to modify any of the Active Directory attributes by simply editing the -property being queried.