Keep it Simple

// practice, the distance between dream and achievement

Tag: Powershell (page 1 of 2)

How to find the Members of a given AD Group?

Is there a command line way to list all the users in a particular Active Directory group? Yes, we can achieve this PowerShell without having to install additional plug-ins.

$groupName = “GroupName”

$users = ((net group $groupName /domain |  Where-Object { $_ -notmatch ‘^(The request|$|Group Name|Comment|Members|–|The c)’ }) -replace ‘\s+’, ‘,’ -split “,”) | where {$_ -ne “”}

Invoking C# Generic Methods in PowerShell

A question recently came in asking, “How do you invoke a generic method on a non-generic class in PowerShell?”

Take, for example, the following class definition

Continue reading

Using C# code in Powershell

It would be great if the existing C# code could be reused inside Powershell without a need to implement it as Cmdlet.

And indeed the Powershell Version 2 provides a way to achieve this using the Add-Type Cmdlet which allows to generate a new .NET assembly using the provided C# source code in memory which can then be used by powershell scripts executed in the same session.

Continue reading

AngleSharp

There are a few good HTML & CSS parsing libraries out there, but AngleSharp definitely stands out among them by giving .NET developers all the same possibilities of modern browsers using JavaScript.

Continue reading

Older posts

© 2017 Keep it Simple

Theme by Anders NorenUp ↑