Great Technology Talk

Thursday, February 11, 2016

PowerShell - how to combine Get-NetAdapter with Get-NetIPAddress with Select-Object

Get-NetIPAddress doesn't show me the MacAddress of the adapters. So I want values from both of these commands in one table. So here is my solution using the power of Select-Object:

Get-NetAdapter |? Status -eq "Up" | SORT MacAddress | Select-Object @{n='Name';e={$_.NAME}},`
@{n='MacAddress';e={$_.MacAddress}},`
@{n='LinkSpeed';e={$_.LinkSpeed}},`
@{n='IPAddress';e={Get-NetIPAddress -InterfaceIndex $_.InterfaceIndex -AddressFamily IPv4 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty IPAddress}},`
@{n='PrefixLength';e={Get-NetIPAddress -InterfaceIndex $_.InterfaceIndex -AddressFamily IPv4 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty PrefixLength}}`
 | ft -AutoSize


Here is my output:


You could save this into your powershell profile as a function if you wanted, or include it in your scripts after modifying network settings.

Labels:

Friday, September 25, 2015

How to set QOS MultiInstance Policies in Windows Server 2016

If any of you have been testing Storage QOS in Windows Server 2016 here is a recently published walkthrough on how to set it up and test it. 

You can check it out on Channel 9: https://channel9.msdn.com/Series/Server2016Storage/Storage-QoS-MultiInstance-Policies


Labels: , , ,

Friday, September 18, 2015

SDN is mainstream - Microsoft has their own Linux SDN distro

Microsoft shocked the tech community today when they announced that they are building their own Linux based network OS called Azure Cloud Switch to run their Azure switches.  Microsoft is a member of the Open Compute Project and is a founding member and contributors to the Switch Abstraction Interface standard.  They are not the first large company to move to a Linux SDN stack to run their datacenter switches.  Google and Facebook have been doing this for over a year.

Facebook: http://www.datacenterknowledge.com/archives/2015/02/11/new-six-pack-switch-powers-facebook-data-center-fabric/

Facebook: http://www.datacenterknowledge.com/archives/2014/06/18/facebook-breaks-network-switch-modules/

Microsoft: http://www.datacenterknowledge.com/archives/2015/09/18/microsoft-builds-own-linux-based-data-center-network-os-for-azure/

Two weeks ago it was Microsoft on-stage for the keynote at VMworld. Then it was Cortana deeply integrated into Cyanogen.  What's the next surprise from Redmond?

Thursday, June 27, 2013

Rename folders recursively using PowerShell

When recursively renaming folders in PowerShell you have to start with the deepest folders first. This can be a challenge...
This script replaces "-" with "_" in folder names recursively.
 I use this for my Photo storage folders.

$dirs = gci -Path "F:\_ImageDrop" -Recurse |Where-Object {$_.PSIsContainer -eq 1}| %{$_.FullName} | Sort-Object -Property length -Descending  
foreach ( $dir in $dirs ) {
    $item = Get-Item $dir
    $oldpath = $($item.fullname)
    $oldname = $($item.fullname | split-path -leaf)
    $newname = $($oldname) -replace "-","_"
    write-host Checking Path: $oldpath
    if (!$oldname.contains($newname)) {Write-Host Renaming $oldname to $newname; Rename-Item -Path $oldpath -NewName $newname}
    }

Labels:

Friday, December 18, 2009

Find and rename folders with powershell and REGEX

dir 06* | %{rename-item $_ -newname ($_.name -Replace "^06","2006")}

Used it to find all my photo folders starting with 06 and renamed them to 2006.

Labels:

Friday, May 22, 2009

Powershell: Return GPO OU links

Wrote a powershell function to return OU links for a GPO.

###########################################################################
# Function : GetGpoOULinks
# Description: Returns all OU links for GPOs in the current domain
# Parameters : $objGPO - GPO object
# Returns : Array of OU links for the GPO.
###########################################################################
function GetGpoOULinks(
$objGPO=$(throw '$objGPO is required'))
{
$gpmSearchCriteria = $gpm.CreateSearchCriteria()
$gpmSearchCriteria.Add($gpmConstants.SearchPropertySomLinks, $gpmConstants.SearchOpContains, $objGPO)
$gpmSomList = $gpmDomain.SearchSOMs($gpmSearchCriteria)

$srtResults=@()
#$srtResults=$($objGPO.displayname) +":"+ $($objGPO.id)+","
if ($gpmSomList.Count -ne 0)
{
foreach ($som in $gpmSomList)
{
$links=$som.GetGPOLinks()
foreach ($link in $links)
{
If ($link.gpoid -eq ($objGPO.id)){
If ($link.enabled){
$srtResults=$srtResults + "$($som.name) (T),"
}
Else
{
$srtResults=$srtResults + "$($som.name) (F),"
}
}
}
}
}
Else
{
$srtResults=$srtResults + "GPO Unlinked" # This GPO is unlinked.
}
return $srtResults
}



Used it in a script that searched sysvol for GPOs that matched certain criteria, when found I queried AD to return where those GPOs were linked.

Labels: ,

Thursday, May 24, 2007

SMACK - fixes the Wii remote

Went to the Redmond service center - a very nice lady confirmed that they'd heard of this problem - and believe it or not the fix was to "SMACK" the controller against your hand. Sure enough, she did it and it fixed it. She said that there are very small springs on the sensor that may get stuck. Since the fix - it has been working fine.

Labels: ,