Posts RSS Comments RSS 249 Posts and 391 Comments till now

Archive for March, 2009

Me, You… Powerscripting Podcast. Be there!

Tonight, March 19th 9pm EST
Powerscripting Podcast
UStream: Click Here to listen/watch live

Get-SysInternals (script to update your tools)

For those who don’t know a while back MS started allowing direct access to the SysInternal tools via a WebDav share located here \\live.sysinternals.com\tools. While this did make access to SysInternal tools much eaiser, it still has issues with proxies so I wrote this script (it will be added to my BSonPosh module.)

NOTE: This is for V2 Only


 

Help from the script

.Synopsis
List or updates sysinternal files from the internet

.Description
List or updates sysinternal files from the internet

.Parameter Path
Where you want the files to download to.

.Parameter FileName
The FileName you want to download

.Parameter All
Updates all the Files

.Parameter Passthru
Returns a FileInfo Object for the downloaded file

.Example
# To see a list of available files from Sysinternals
Get-SysInternals

# To download a single file
Get-SysInternals -FileName pslist.exe

# To download all the files available
Get-SysInternals -All

# To download only files you already have
Get-ChildItem C:\tools | Get-SysInternals


 

The Code

Download it: Get-SysInternals.ps1

function Get-SysInternals
{
    <#
        .Synopsis
            List or updates sysinternal files from the internet

        .Description
            List or updates sysinternal files from the internet

        .Parameter Path
            Where you want the files to download to.

        .Parameter FileName
            The FileName you want to download

        .Parameter All
            Updates all the Files

        .Parameter Passthru
            Returns a FileInfo Object for the downloaded file

        .Example
            # To see a list of available files from Sysinternals
            Get-SysInternals

            # To download a single file
            Get-SysInternals -FileName pslist.exe

            # To download all the files available
            Get-SysInternals -All

            # To download only files you already have
            Get-ChildItem C:\tools | Get-SysInternals

        .ReturnValue
            Object

        .Link
            N/A

        .Notes
         NAME:      Get-SysInternals
         AUTHOR:    YetiCentral\bshell
         Website:   www.bsonposh.com
         LASTEDIT:  03/16/2009 18:25:15
        #Requires -Version 2.0
    #>
    [cmdletbinding()]
    Param(
        [parameter()]
        $Path,
        [parameter(ValueFromPipeLine=$true)]
        $FileName,
        [parameter()]
        [switch]$All,
        [parameter()]
        [switch]$Passthru
    )

    Begin
    {
        if(!$Path)
        {
            $ToolsPath = split-path (Get-command pslist.exe).Path -parent
            if(!$ToolsPath)
            {
                $path = Read-Host "Enter Path: "
            }
            else
            {
                $path = $ToolsPath
            }
        }

        Write-Verbose " Path: $Path"
        Write-Verbose " FileName: $FileName"
        write-verbose " ALL: $ALL"
        $Cont = $true
    }
    Process
    {
        if($FileName)
        {
            Try
            {
                Write-Verbose " Downloading File [$FileName]"
                $webclient.DownloadFile("http://live.sysinternals.com/$FileName","$path\$FileName")
                Write-Verbose " ==> Downloaded [$FileName]"
                if($passthru){Get-Item "$path\$FileName"}
            }
            catch
            {
                Write-Verbose " Failed to Download File [$FileName]"
            }
            $cont = $false
        }
    }

    End
    {
        if($Cont)
        {
            # Get file content
            $webclient = New-Object System.Net.WebClient
            $HTML = $webclient.DownloadString("http://live.sysinternals.com/")
            $links = $HTML -split ""
            $Files = @()

            # Building RegEx
            $regex = "^.*y,\s(?.*)(AM|PM)"
            $regex += "\s*(?\d*)\s+\"
            $regex += "<a href="\`">(?.*)\"

            # Creating an Object from the Links
            switch -regex ($links)
            {
                $regex
                {
                    $myobj = "" | Select FileName,Date,Length
                    $myobj.FileName += $matches.FileName
                    $myobj.Date = get-date $matches.Date
                    $myobj.Length = $matches.Length
                    $files += $myobj
                }
            }

            if($All)
            {
                foreach($file in $files)
                {
                    $FileName = $file.FileName
                    Try
                    {
                        Write-Verbose " Downloading File [$FileName] to [$Path]"
                        $webclient.DownloadFile("http://live.sysinternals.com/$FileName","$path\$FileName")
                        Write-Verbose " ==> Downloaded [$FileName]"
                        if($passthru){Get-Item "$path\$FileName"}
                    }
                    catch
                    {
                        Write-Verbose " Failed to Download File [$File]"
                    }
                }
            }
            else
            {
                $files
            }
        }
    }
}&lt;/a&gt;

Proof MS is betting BIG on Powershell

If you haven’t figure this out yet or somehow missed it on my blog. MS is putting a HUGE amount of effort towards Powershell. We are talking dozens and dozens of groups at MS working with Powershell.

Just to let you know how important it is to Microsoft… Check this out

Jeffrey gets Distinguished Engineer

That may not mean much to you… but that is HUGE. There not many (like 36) Distinguished Engineers at MS. It is a huge honor and a testament to the value MS puts in Jeffrey and on Powershell.

Cool new changes plan for Win7 RCx

A few more changes from Beta to RC…

I think I will use most of the new features but of course I think this is the best :)

By default PowerShell in Beta launched a streamlined console. Customers could load optional modules via distinct shortcuts in the Start Menu. We heard from you that this was a confusing experience. Additionally, PowerShell did not surface a way to launch related tasks such as the Integrated Scripting Environment (ISE) from within their console experience. PowerShell now has a robust Jump List that affords a method to load modules, launch the ISE and open documentation.

GPO guy releases new GPMC Tools for Powershell

The GPO Guy just announced

“Just a quick shout-out to let folks know that I posted an update to our SDM Software GPMC Cmdlets on our Freeware page. This is version 1.3 and primarily just fixes some bugs including an issue when you tried to get, add or remove site-based GPO links. Enjoy!”

So… go enjoy!

PowerShell Help on iPhone

SAPIEN brings PowerShell Help to iPhone (iPowershell)

SO COOL!

Turbochargead.org has moved!

It has be refaced and rebranded as The Experts Community located HERE!

It is using a new community site engine called cahoots. Stop by and check it out!

Effective Powershell the FREE! e-book

Read it, know it, love it!
Effective Powershell

For those of you wondering

Windows Key Management Services (aka KMS, Volume Activation 2.0) does INDEED run on Windows 2008 Server Core. I could not find this information anywhere so I tried it and it worked ( I saw no reason why it wouldn’t.)

Back from the MVP Summit…

Man was it good. The flow of information was outstanding. There were a ton of sessions I wanted to attend, but I couldn’t do everything so I basically split my time between the Powershell PG and Directory Services PG.

Now… I know your all saying “While I am glad you had a good time… tell me the good stuff!” I appreciate that. I am currently am waiting for an email from the PG’s letting me know what I can and cannot discuss.