Slide Deck, photos and resources from my Session at ATLPUG

This slideshow requires JavaScript.

The Atlanta PowerShell User’s Group first meeting at iVision went off wonderfully! We had a solid turn out, plenty of pizza and soda, and talked a whole lot about PowerShell, what’s new, and whats coming.

Here’s the demo I worked through exploring features using the ISE  Props to Mike Robbins for showing me this technique!

#Check our Version, needs to be greater than 5.0.  version 9814 is the most up to date version (September preview)
Get-host | Select-Object -Property Version

#region Working with Archives
Set-location C:\Demo

#Something to do with Archives, so lets look for ZIP
Get-Command *-Zip

Get-Command *-Archive

Compress-Archive -Path C:\demo -DestinationPath c:\demo\ -CompressionLevel Optimal
#mkdir Unzipped


#region Modules
#Find-module                    #xActiveDirectory, xJea, 



#region #ONEGET

#One-Get is Apt-Get come to Windows.  It is awesome!

#Import the Module
Import-Module OneGet

#List all commands for the module, will prompt to install nuget
Get-Command -Module OneGet

#Search your repo's for packages available DONT RUN!
$OriginalPackages = Find-Package

#Number of packages
Find-Package | Measure-Object | Select -Property Sum

#Not that many apps, where'd they all go?  Let's check our package Sources

#by default, we only have PSGallery and MSPSGallery as sources...let's add Chocolatey.  Previously this was Add-PackageSource, it's changed!
$PackageSourceLocation  = ""
Register-PackageSource -ProviderName PSModule -Name Chocolatey -Location $PackageSourceLocation -Trusted -VERBOSE

#After adding Chcolatey DONT RUN!
$FullPackages = find-package 

#Total count of packages now ~
Find-Package | Measure-Object | Select -Property Sum

find-package evernote 

#Search for apps with a summary that mentions PDF
find-package | Where Summary -like "*pdf*"

find-package evernote | install-package -force

#region Convert-FromString
$TraceRT = tracert -h 6 -w 45 #hops 6, -waiting 45 milliseconds

$TraceRT[(3..12)] #Skip the first few lines

$TraceRT[(3..12)] -replace "^\s+" | ConvertFrom-String -PropertyNames Hop,Latency1,Latency2,Latency3,ServerName,ServerIP #Props to Francois Xavier Cat for this regex and general idea

$TraceRT[(3..10)] -replace "^\s+" -replace 'ms','' -replace '[ \t]+$','' | ConvertFrom-String -PropertyNames Hop,Latency1,Latency2,Latency3,ServerName,ServerIP


#region DSC Stuff
#Remove-item $env:windir\system32\MonitoringSoftware -Confirm -Force

Configuration InstallXMLNotePad

    Node $MachineName
        File InstallFilesPresent
            Ensure = "Present"
            SourcePath = "\\localhost\Installer"
            DestinationPath = "C:\Demo\InstallFiles"
            Type = "Directory"
            Recurse=$true       # can only use this guy on a Directory

        Package XMLNotePad
            Ensure = "Present"  # You can also set Ensure to "Absent"
            Path  = "C:\Demo\InstallFiles\XmlNotepad.msi"
            Name = "XML Notepad 2007"
            ProductId = "FC7BACF0-1FFA-4605-B3B4-A66AB382752D"
            DependsOn= "[File]InstallFilesPresent"




Start-DscConfiguration -Path InstallXMLNotePad -Wait -Verbose -Force

#Cleanup Demo
Unregister-PackageSource -ProviderName PSModule -Name Chocolatey

Here’s the function we created on stage, which recieves and parses output from Trace Route using Convert-FromString.

function Test-Route{

      Write-Host "Tracing Route from localhost to $Servername, capturing $Hops Hops and waiting $Wait MS"
      $TraceRT = tracert -h $Hops -w $Wait $ServerName #hops 6, -waiting 45 milliseconds

      $TraceRT[(3..10)] -replace "^\s+" -replace 'ms','' -replace '[ \t]+$','' | ConvertFrom-String -PropertyNames Hop,Latency1,Latency2,Latency3,ServerName,ServerIP

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s