Add NTAccount Permissions To a Printer Queue

Here is a little but handy Cmdlet allowing you to add various type of permission for a NT account on a print queue.
This Cmdlet requires Powershell 3.0 and has been tested on Windows Server 2008 R2 SP1 and Windows 2012 R2.

This Cmdlet could be usefull to add a Trustee to the ACL of all the print queues on a Print Server like in the example shown below:

Only want a list of file system entries and not a list of file system objects ?

This post follow the spirit of the previous one…

“Sometimes do not use the Powershell Cmdlets, .NET in place”

Get-ChildItem, is a very fast Cmdlet but if you only want an array of full names instead of an array of objects, there is a .NET function you should try : System.IO.Directory.GetFileSystemEntries

Lets try this piece of code that will retrieve 11207 file system entries :

And here the result I got…

Get-ChildItem Elapsed Time: 1491
Get File System Entries Elapsed Time: 199

Of course GetFileSystemEntries only returns an array of string but it is about 7 time faster !!!

Powershell Cmdlets are not always the way to go…

Hi all,

Maybe have you already noticed that if you compare some .NET functions and their equivalent in Powershell, in term of speed you are far behind what can be achieved in .NET… An example with facts ? Of course here is one :

If you run the script above you will notice the difference, in my case I tried it against a host with a good (less than 1ms latency) and stable connection… And the result is :

TestConnection Average time : 47 ms
Ping Average time : 15,64 ms

The .NET Ping function is about 3 time faster !!! If you have to ping a lot of host, Ping is the way to go 😉
Another added value with the .NET Ping function ? You can define the “DontFragment” option which can be very handy to test link quality and adjust you MTU (Maximum transmission unit).

[Cmdlet] Multithreaded execution of Scriptblock

[Cmdlet] Password generator

[Cmdlet] Query a computer to see if it has a certain KB installed

[Cmdlet] Get All AD Group membership for a given user

[Cmdlet] Retrieve Group Policy Object content size