Will you attend the PowerShell Summit in Amsterdam?

0

Have you ever wanted to visit an event with PowerShellians? Only PowerShellians?
An event where industry experts, MVP’s and the PowerShell Product Team is presenting and giving you the scoop on the wonder that is PowerShell?
Well… here’s your chance!

The PowerShell Summit comes to Europe! (Amsterdam to be precise)

Back in 2012, before I became an MVP, I registered for the PowerShell Summit North America.
I was completely psyched that I would get to meet guys like Jeff Hicks, Don Jones, Jeffrey Snover, Richard Siddaway, Ed Wilson and many more…
Attending this event left me with a wonderful feeling and a head hurting of the knowledge gained in just a few days.
Events, both visiting and presenting at, is a main part of what drives my passion.
But… I noticed that lack of PowerShell deep dive session at the larger events.
Why is that? Because if you do a deep level session and most people won’t be able to follow/comprehend, the speaker would get bad ratings.
So speakers can’t go deep dive at such events!

The PowerShell Summit doesn’t have that problem :-) This because all attendees have a focus on PowerShell, though some stronger than others.
You’re a newbie to PowerShell? No problem, speakers will take you step by step so you won’t be thrown into the lake in the hopes that you may swim, or not ;-)

Just to give you an idea…
Here is the PowerShell.org Youtube Channel… and to provide a glimpse of the content of the sister event, PowerShell Summit North
America, this year you can take a look at this playlist.

PowerShell – Howto remove white lines?

0

This is something I get asked quite a lot.
Some people use the -Replace operator, others the .Replace() method.
Did you know you could use a regex for this?
Easy and very, very fast :-)

(get-content MyFile.txt) -match '\S'

Get the process owner via PowerShell

0

Let’s say you’ve got an app that needs to be closed throughout your environment.
If you can identify that app by a running process, you’ll probably want to know who has the application/process still running.
For this goal I’ve written the following function in order to get the name of the owner (read: person running the app) of the process.

function Get-ProcessOwner {
    <#
        .SYNOPSIS
        Get the owner of a process.
        .DESCRIPTION
        Get the owner of a process via WMI.
        .PARAMETER ComputerName
        Gets the processes owner of processes running on the specified computers.
        The default is the local computer.
        .PARAMETER ProcessName
        Specifies one or more processes by process name.
        You can type multiple process names (separated by commas).
        .EXAMPLE
        PS C:\> Get-Process -ComputerName minimonster -Name notepad | Get-ProcessOwner

        ProcessName       UserName       Domain          ComputerName      handle
        -----------       --------       ------          ------------      ------
        notepad.exe       Jeff           MINIMONSTER     METHOS            2228
        .EXAMPLE
        PS C:\>  Get-ProcessOwner 'notepad.exe' -ComputerName RDS01

        ProcessName       UserName       Domain          ComputerName      handle
        -----------       --------       ------          ------------      ------
        notepad.exe       Jeff           RDS01           METHOS            2228
        notepad.exe       Lars           RDS01           METHOS            3466
        notepad.exe       Angelique      RDS01           METHOS            8672
        .EXAMPLE
        PS C:\>  Get-ProcessOwner 'notepad.exe' -ComputerName RDS01,MINIMONSTER

        ProcessName       UserName       Domain          ComputerName      handle
        -----------       --------       ------          ------------      ------
        notepad.exe       Jeff           RDS01           METHOS            2228
        notepad.exe       Lars           RDS01           METHOS            3466
        notepad.exe       Angelique      RDS01           METHOS            8672
        notepad.exe       Jeff           MINIMONSTER     METHOS            2228
        .NOTES
        Author: Jeff Wouters
    #>
    [cmdletbinding()]
    param(
        [parameter(mandatory=$false,position=0,valuefrompipelinebypropertyname=$true)]$ComputerName=$env:COMPUTERNAME,
        [parameter(Mandatory=$true,position=1,valuefrompipelinebypropertyname=$true)]$ProcessName
    )
    begin {
        $PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]@($(New-Object System.Management.Automation.PSPropertySet(‘DefaultDisplayPropertySet’,[string[]]$('ProcessName','UserName','Domain','ComputerName','handle'))))
    } process {
        try {
            $Processes = Get-wmiobject -Class Win32_Process -ComputerName $ComputerName -Filter "name LIKE '$ProcessName%'"
        } catch {
            Write-Warning "Unable to query $ComputerName via WMI"
        }
        if ($Processes -ne $null) {
            foreach ($Process in $Processes) {
                $Process | 
                Add-Member -MemberType NoteProperty -Name 'Domain' -Value $($Process.getowner().domain) -PassThru |
                Add-Member -MemberType NoteProperty -Name 'ComputerName' -Value $ComputerName -PassThru |
                Add-Member -MemberType NoteProperty -Name 'UserName' -Value $($Process.getowner().user) -PassThru | 
                Add-Member -MemberType MemberSet -Name PSStandardMembers -Value $PSStandardMembers -PassThru
            }
        } else {
            Write-Warning "No processes found that match the criteria on $ComputerName"
        }
    } end {
    }
}
Go to Top