• 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))
    

  • Installing WordPress via shell script(BASH)

    We have been using a provisioning script that downloads the latest wordpress zip file, extracts into the right location it and sets up the DB connection. I wanted to take it a step further and eliminate the install.php page. The one that looks like this:Screen_Shot_2013-03-06_at_3.54.19_PM-2

     

    So i sat down to figure out how to “Install WordPress” via shell script. Here is that command:

    SITENAME="blog"
    DOMAINNAME="company.com"
    PASSWORD="MySecurePassword"
    wp_install_result=$(php -r 'define("WP_SITEURL", "http://'$SITENAME.$DOMAINNAME'");define("WP_INSTALLING", true);require_once("./wp-load.php");require_once("wp-admin/includes/upgrade.php");$response=wp_install("TITLE", admin, "[email protected]", false, null, "'$PASSWORD'");echo $response;')
    

     
    After WordPress is “installed”, we can now activate plugins.


  • Activating and deactivating WordPress plugins from a shell script (BASH)

    I needed to update my WordPress site provisioning script to download, install and activate a WordPress plugin. The download is the easy part (I just use wget). But how do I activate the plugin. This is what I cam up with:

    result=$(php -r 'require_once("./wp-load.php");require_once("wp-admin/includes/admin.php");activate_plugin("hello.php");')
    

    And to be complete, to deactivate:

    result=$(php -r 'require_once("./wp-load.php");require_once("wp-admin/includes/admin.php");deactivate_plugins("hello.php");')
    

  • A simple javascript/AJAX function to post a SOAP request to CRM 2011

    This is a simple function that I use to post a SOAP envelope to CRM 2011. Just pass the URL and the xml (you can create that with this function) and you should be good to go

        function soapToCRM(URL, data) {
            var returnValue
            $.ajax({
                type: "POST",
                contentType: "text/xml; charset=utf-8",
                datatype: "xml",
                async: false,
                url: URL,
                data: data,
                beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");
                    XMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
                    XMLHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
                },
                success: function (data, textStatus, XmlHttpRequest) {
                    //alert("success");
                    var NewCRMRecordCreated = data["d"];
                    returnValue = true
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert("failure " + errorThrown);
                    returnValue = false;
                }
            });
            return returnValue;
        }
    

  • Using AJAX and SOAP to create a CRM 2011 activity

    I have posted a bunch of PowerShell scripts to interact with CRM 2011, now I am going to put up similar javascript versions. I feel that there is a lot of javascript content out there for CRM 2011, but most of it is javascript inside the actual CRM interface. I don’t see a lot of content about using javascript from a different webpage/site with ajax, so I thought I would post some of the code I put together.

    This is a function that I put together to build a SOAP envelope for creating an activity in CRM 2011. Credit for the template goes to Jamie Miley and this post. I took his template a little further and created a function for either email,Phone call or appointment. In addition this function allows for multiple contacts in an phone call’s to and multiple required contacts in a meeting.

    (more…)