• Quick PowerShell script to “tail -f” dhcp logs

    When I am working in Linux, I like to leave a log open with “tail -f”, so I can see the results of some test I am performing.

    The other day I wanted to see when a new machine joined the network, so I could give it a static DHCP lease. Usually I connect to the DHCP server find the DHCP logs and open them in notepad. I finally wrote a quick script to “tail -f dhcp.log” in PowerShell.

     

    function JBM-AD-GetDHCPLogs {
     PARAM($ServerName="dhcpServerName")
     $FileName="DhcpSrvLog-$(get-date -format ddd).log"
     $PATH="\\$ServerName\c$\Windows\System32\dhcp\$FileName"
     Get-Content $path –Wait
     }
    

  • ACLs for Azure end points!!

    sweet. Have they always been there?


  • No charge for stopped VMs in azure

    Sweet


  • WWDC prediction – Retina cinema displays

    Thin as can be. I am reading an article in Wired that talks about the cubicles in start-up offices having MacBooks hooked up to monitors. Seems that apple need new high def monitors for these type offices. My thoughts.


  • Headed to MSTechEd!!

    Hopefully. Weather between here and New Orleans is rough.


  • Cisco ASA 5505 from Factory Default to Static Address and defined inside subnet

    I have been playing with an ASA 5505 lately. I wanted the ability to start fresh when I could not figure things out. I came up with the following commands to cut and paste into the console, allowing me to “Start over”.

    First I reset to factory default and set the internal subnet range

    configure factory-default 192.168.123.1 255.255.255.0
    

    You have to hit the space bar a couple of times, then paste in the next sections:

    boot system disk0:/asa911-k8.bin
    interface Vlan2
     ip address 123.123.123.123 255.255.255.0
    route outside 0.0.0.0 0.0.0.0 38.117.203.126
    dhcpd dns 8.8.8.8
    dhcpd address 192.168.123.5-192.168.123.132 inside
    dhcpd enable inside
    
    ssh scopy enable
    ssh 192.168.123.0 255.255.255.0 inside
    ssh timeout 60
    ssh version 2
    console timeout 0
    username myusername password 3ncrypt3dp4$$w0rd encrypted privilege 15
    no call-home reporting anonymous
    
    !-- Optional - allow pings outbound
    policy-map global_policy
      class inspection_default
       inspect icmp
       exit
       exit
    !
    

    This code above sets the external IP, enabled DHCP internally, enables ssh and scope, creates a user, and allows pings through.

    I hope this might help someone.


  • Useful PowerShell Get-HotFix commands

    I can never remember these, and now that I have posted them, I don’t have to! I will add more as I need them:

    Get-HotFix | Where-Object {$_.HotFixId -eq "KB2823324"}
    Get-HotFix | Sort-Object -Property InstalledOn
    

  • Import Picture into AD with PowerShell

    I know this is everywhere, so this is more a note for myself. How to upload pictures to AD via PowerShell:

    Import-RecipientDataProperty -Identity username -Picture -FileData ([Byte[]]$(Get-Content -Path .\username.jpeg -Encoding Byte -ReadCount 0))