Saturday, 10 November 2012

Get-Scripting Podcast Episode 32



This is Episode 32 of the Get-Scripting podcast. Tune in to listen to us talk and interview people about PowerShell.

Download it here, subscribe in iTunes or via a different feed reader.

Intro:

Alan:



Jonathan:

PowerShell Deep Dive Book



PowerShell News:


Windows 8 / Server 2012 released, i.e. PowerShell v3!

Available for downlevel OSs.

http://www.microsoft.com/en-us/download/details.aspx?id=34595



Scripting IDE showdown / slowdown?

PowerShell Plus is now free:

http://www.idera.com/Free-Tools/PowerShell-Plus/

PowerShell SE is no more?

http://powerwf.com/products/powerse.aspx

PowerGUI no longer in development?

PowerShell ISE the way ahead?




PowerShell Summit - Session Announced


http://poshoholic.com/2012/11/02/powershell-summit-community-sessions-list/


UKVMUG

http://www.vmug.com/p/cm/ld/fid=212




PowerShell Resources:



Get Regular Expression matches (DNS)


http://enterpriseadmins.org/blog/scripting/get-regular-expression-matches/


PowerScripting - the wives special

http://powerscripting.wordpress.com/2012/05/28/episode-187-teresa-scriptingwife-wilson-and-staci-halswife-rottenberg/



PowerShell Tip


Insert String Every N Characters


http://blog.expressionsoftware.com/2010/03/insert-string-every-n-characters.html

This PowerShell v2 script inserts a string every N characters. The interval is specified using the regex repetition operator, {min,max}.
$a = 'abcdefghijklmnopqrstuvwxyz'
([regex]::matches($a, '.{1,3}') | %{$_.value}) -join ' '
([regex]::matches($a, '.{1,8}') | %{$_.value}) -join '..'
([regex]::matches($a, '.{1}') | %{$_.value}) -join '-'

#output
abc def ghi jkl mno pqr stu vwx yz
abcdefgh..ijklmnop..qrstuvwx..yz
a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z

Removal of $_ and also $PSItem in PS v3

In PowerShell, the variable "$_" has special importance. It works like a placeholder in scenarios like this one:
PS> Get-ChildItem $env:windir | Where-Object { $_.Length -gt 1MB }
In PowerShell v3, there is an alias for the cryptic "$_": $PSItem. So now code can become more descriptive:
PS> Get-ChildItem $env:windir | Where-Object { $PSItem.Length -gt 1MB }
Then again, in PowerShell v3, "$_" isn't necessary in many scenarios anymore at all. You could also write:
Get-ChildItem $env:windir | Where-Object Length -gt 1MB






Feedback

Send us feedback at

get [dash] scripting [at] hotmail [dot] co [dot] uk

or leave a comment here on the blog


Follow us on Twitter and join our Facebook Group

http://twitter.com/getscripting
http://twitter.com/jonathanmedd
http://twitter.com/alanrenouf

Get-Scripting Facebook Group

Extensive list of Powershell Twitterers

Tuesday, 24 July 2012

Get-Scripting Podcast Episode 31 - (Jonathan Noble talks PowerShell v3)


This is Episode 31 of the Get-Scripting podcast. Tune in to listen to us talk and interview people about PowerShell.

Download it here, subscribe in iTunes or via a different feed reader.

Intro:

Alan:

Easily creating PowerShell Quick References

Jonathan:

PowerShell and XenDesktop at the UK PowerShell User Group

Automating MSI Installations with PowerShell

Checking 32bit PowerShell Snapins from 64bit PowerShell


Interview:




Jonathan Noble - Blog

http://www.jonoble.com/blog/2012/1/19/whats-new-in-powershell-v3-the-slides.html

http://www.virtu-al.net/2012/06/05/installing-powershell-web-access-on-windows-2012-rc-core/

http://blogs.msdn.com/b/powershell/archive/2012/06/14/new-v3-language-features.aspx




PowerShell News:

Windows Server 2012 Release Preview is out. Full release to ship in August. Then we will be in v3!

PowerShell Resources:


PowerShell for Network Pen Testing series over on Hey Scripting Guy


http://blogs.technet.com/b/heyscriptingguy/archive/tags/niklas+goude/


Be efficient – Virtualize & automate your test environment


http://blogs.vmware.com/vipowershell/2012/06/be-efficient-virtualize-automate-your-test-environment.html


PowerShell Gotcha



Numeric values as the first character in parameter names:


function foo {
[cmdletbinding()]
param (
[parameter()]
[switch]$32bit
)
if ($32bit){
"32bit"
}
}
PS c:\> foo -32bit
foo : A positional parameter cannot be found that accepts argument '-32bit'.


Workaround! - $x86
From the language specification document:


http://www.microsoft.com/en-us/download/details.aspx?id=9706

(no Nd)
first-parameter-char:
A Unicode character of classes Lu, Ll, Lt, Lm, or Lo
_ (The underscore characterU+005F)
?


https://connect.microsoft.com/PowerShell/feedback/details/753467/using-a-numeric-character-as-the-first-character-of-a-parameter-name-should-produce-a-clearer-error-message-and-be-permitted-if-it-also-contains-non-numeric-characters


Feedback

Send us feedback at

get [dash] scripting [at] hotmail [dot] co [dot] uk

or leave a comment here on the blog


Follow us on Twitter and join our Facebook Group

http://twitter.com/getscripting
http://twitter.com/jonathanmedd
http://twitter.com/alanrenouf

Get-Scripting Facebook Group

Extensive list of Powershell Twitterers

Wednesday, 30 May 2012

Get-Scripting Podcast Episode 30 - (Jan Ring talks SCVMM)

This is Episode 30 of the Get-Scripting podcast. Tune in to listen to us talk and interview people about PowerShell.

Download it here, subscribe in iTunes or via a different feed reader.

Intro:
Alan:



Jonathan:

Working a contract for Citrix via Start-Automating


Interview:



Jan Ring

Blog

PowerShell News:

Scripting Games have taken place

PowerShell and WMI book from Richard Siddaway published

PowerShell Resources:


PoshChat


Convert Images to Text Ascii Art



Unofficial vCD Cmdlets





Don Jones - PowerShellbooks.com

PowerShell Tips:


Escaping a Regex when using -match

PS V:\> $TestError = "This is a (test)"

____________________________________________________________________________________________________________________________________
PS V:\> $RealError = "This is a (test)"

____________________________________________________________________________________________________________________________________
PS V:\> $TestError -match $RealError
False

____________________________________________________________________________________________________________________________________
PS V:\> $TestError -match [regex]::Escape($RealError)
True

____________________________________________________________________________________________________________________________________
PS V:\> $RealError = "This is a \(test\)"

____________________________________________________________________________________________________________________________________
PS V:\> $TestError -match $RealError
True


http://www.vistax64.com/powershell/199639-comparing-string-contains-parenthesis.html

Get Index of Item in an Array

Multiple Variable Assignment

PS C:\> $a,$b = 'apple','pear'

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\> $a
apple

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\> $b
pear



or


PS C:\> $a,$b = 'apple','pear','banana'

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\> $a
apple

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
PS C:\> $b
pear
banana

PowerShell Gotcha


Chat with Hal - ValidationSet not working with tab completion, enumeration.
Function a {

Param

(

[parameter(Mandatory=$true)]

[ValidateSet("Low", "Average", "High")]

[String[]]

$Detail

)

Process {

Write-Host $Detail

}

}

Feedback

Send us feedback at

get [dash] scripting [at] hotmail [dot] co [dot] uk

or leave a comment here on the blog


Follow us on Twitter and join our Facebook Group

http://twitter.com/getscripting
http://twitter.com/jonathanmedd
http://twitter.com/alanrenouf

Get-Scripting Facebook Group

Extensive list of Powershell Twitterers

Sunday, 11 March 2012

Get-Scripting Podcast Episode 29 - (Pete Rossi talks Datacentre Automation)

This is Episode 29 of the Get-Scripting podcast. Tune in to listen to us talk and interview people about PowerShell.

Download it here, subscribe in iTunes or via a different feed reader.

Intro:

Alan:


vCheck 6.15

PowerCLI for vCD: Basic Usage and Stopping and Starting vApps

Top Virtualisation Blogs


Jonathan:

Manage vCenter Plugins with PowerCLI

Interview:

Pete Rossi

Blog

SSH Component from WeOnlyDo

PowerShell News:

Scripting Games 2012


PowerShell Resources:

Create HMTL Graphs from PowerShell

Creating graphical charts with PowerCLI and PowerShell

What's New in PowerShell V3 - Jonathan Noble

Balloon Tips function


Powershell Tips:

Encrypt Password in a file for use in a script


Feedback

Send us feedback at

get [dash] scripting [at] hotmail [dot] co [dot] uk

or leave a comment here on the blog


Follow us on Twitter and join our Facebook Group

http://twitter.com/getscripting
http://twitter.com/jonathanmedd
http://twitter.com/alanrenouf

Get-Scripting Facebook Group

Extensive list of Powershell Twitterers

Saturday, 11 February 2012

Get-Scripting Podcast Episode 28 - (Paul Iddon talks PowerShell and MDT)

This is Episode 28 of the Get-Scripting podcast. Tune in to listen to us talk and interview people about PowerShell.

Download it here, subscribe in iTunes or via a different feed reader.

Intro:

Alan:


vShield PowerShell Module

Using Console 2

PowerCLI 5.0.1 Release and vCD Cmdlets

vCheck6


Jonathan:

Testing Port Response

Checking Automatic services have started

Configuring HP EVA recommended vSphere settings with PowerCLI

Basic VMware Cluster Capacity Check

2nd place in the London VMUG vBaftas for community presentations in 2011


Interview:

Paul Iddon

Blog

PowerShell News:



PowerShell Deep Dive

Don Jones, Jeffrey Hicks and Richard Siddaway new book

PowerShell Resources:

Using PowerShell to list shared folders and permissions.

ByValue and ByProperty Parameter Binding

Using PowerShell with Internet Explorer

Powershell Tips:

Invoke-Sqlcmd

Alias attribute for advanced function parameters


PowerShell Gotcha


Text file with $false in it, read this into a variable and you have $false

Use it in an If Statement and what do you get (True)

You need to invoke-expression because it has a $ infront of it, so call it with powershell to actually run the powershell code so you can get the results.

[Boolean]$Var = $False
$Var = [System.Convert]::ToBoolean("$True")


Feedback

Send us feedback at

get [dash] scripting [at] hotmail [dot] co [dot] uk

or leave a comment here on the blog


Follow us on Twitter and join our Facebook Group

http://twitter.com/getscripting
http://twitter.com/jonathanmedd
http://twitter.com/alanrenouf

Get-Scripting Facebook Group

Extensive list of Powershell Twitterers

Wednesday, 30 November 2011

Get-Scripting Podcast Episode 27 - (The One Where They Catch Up and Share Loads of PowerShell Tips and Tricks)

This is Episode 27 of the Get-Scripting podcast. Tune in to listen to us talk and interview people about PowerShell.

Download it here, subscribe in iTunes or via a different feed reader.

Intro:

Alan:

PowerCLI @ VMworld

PowerCLIMan - The Return

Alan on PowerScripting

Jonathan:

HP WMI Provider


Simple Talk - How to add a GUI front end to your PowerShell scripts


What's New In PowerCLI 5.0 at the UK PowerShell User Group

PowerShell V3 Blog Series


PowerShell News:


PowerShell V3 Preview Out as part of Win8 Developer Preview


2012 Deep Dive Conference Announced for San Diego


PowerShell Resources:

Distributed Switch Cmdlets available as a fling

PowerShell scripts to leverage UBERalign for virtual disk alignment

Get-FriendlyUnits from @lucd22

Jeffrey Snover has a blog

Cmdlet of the day podcast


Powershell Tips:

Copy-Item With Alternate Credentials

Netstat for ESXi

Splitting a string with the split operator containing a ".", e.g. test.test.com

$EscapeTest = [Regex]::Escape("test.test.com")
$EscapeTest.split("\.")

Also [URI]"http://test.com/alan"


How to create a PSCredential object


PowerShell Gotcha

'Set-Service -Status Stopped' fails with "Cannot stop service 'servicename' because it is dependent on other services‏

Catching WMI Query Errors with Try / Catch

- Workaround: You can make non-terminating errors get thrown by using: - -ErrorAction "Stop"


Feedback

Send us feedback at

get [dash] scripting [at] hotmail [dot] co [dot] uk

or leave a comment here on the blog


Follow us on Twitter and join our Facebook Group

http://twitter.com/getscripting
http://twitter.com/jonathanmedd
http://twitter.com/alanrenouf

Get-Scripting Facebook Group

Extensive list of Powershell Twitterers