More Notes

Text Editor (Notepad++)

    Block Select (Alt+Select)




        $date = get-date 2/25/2010

        $date = $date.AddHours(8)

        $Blahpathlist = gci "\\server\Backup$\Full Backups" -include *.sqb -Recurse | where {$_.LastWriteTime -ge $date } | select FullName

        $Blahpathlist > BlahPathlist.txt

        Macro1 Use a text editor to remove trailing spaces from each line

        Macro2 format the sql query



    New in Powershell 2 (Windows Remote Management - WinRM)

        GUI IDE


        Script Cmdlets

    Additionals tools

        Quest Active Roles powershell (Nice cmdlets)

        less.exe (when you want to be able to read help files)

    tab completion



    Important cmdlets


            how to read (syntax)



            get-help about

            get-help get-p

            Get-Help -Online Get-Member



            get-command dir

            get-command Get-ChildItem

            Get-Command select

            Get-Command -CommandType function

            get-command -verb get

            get-command -noun job

            get-command | where {$_.Parameters.ContainsKey("Credential")}

            Get-Command -Module Citrix.XenApp.Commands | where {$_.Parameters.ContainsKey("Credential")}




        get-help *variable*

        Built-in Variables



        $foo = "blah"

        [string]$foo = "blah"

        $foo | gm



        $a | gm



        get-help array | more 

        $b = 1,2,3,"blah"




         get-help hash | more

         $hash=@{'Home'="123 main street";'Work'="456 Blah Ave"}











        get-eventlog -newest 10  


        $c = 1..10 (.. range operator)


        $c | foreach {$_ * 2}




        cd hklm:

        Get-Command cd

        get-command c:

        Set-Location hklm:

        cd function:


        function env: {Set-Location env:}

        Get-Content Function:\TabExpansion


        dir (gci)



        Get-WmiObject win32_logicaldisk | gm

        Get-WmiObject win32_logicaldisk | select DeviceID, Compressed

        $cred = Get-Credential

        Get-WmiObject -ComputerName cspcdc02 -Credential $cred win32_logicaldisk | select DeviceID, __SERVER, Compressed