Tag Archives: Technet

250000 Downloads in Technet Script Gallery

Jaap Brasser - TechNet Script GalleryApproximately one year ago I saw the number of downloads tick over a hundred thousand, today my total downloads from the TechNet Script Gallery has reached 250,000.  To celebrate this milestone I have uploaded all of the scripts I have stored in the TechNet Script Gallery also to GitHub to simplify the updating and collaboration with others.

My personal preferred method of installing and sharing scripts is by using the PowerShell Gallery, which is available at PowerShellGallery.com or by using the PowerShellGet cmdlets, for example the following two lines of code can find the scripts and modules I have currently posted:

1
$(Find-Script;Find-Module).Where{$_.Author -match 'Jaap Brasser'}

FindModuleandScripts

The complete list of my scripts is now available on GitHub:
Jaap Brasser – GitHub – SharedScripts
Jaap Brasser - GitHub - SharedScripts

And also in the TechNet Script Gallery:
Jaap Brasser – TechNet Script Gallery

As I personally mostly see benefit in sharing of modules and not so much single scripts and function I am working on converting some of the scripts I have written into modules and once they are finalized I will upload those to the PowerShell Gallery as well. So my question to the community is as follows, which improvements are you most interested in or what would you like to see next?

Feel free to use the comment section underneath this post to share your ideas or feedback. That is it for now, until the next milestone!

250,000 Downloads
My TechNet Community Profile
My entries in TechNet Script Gallery
Jaap Brasser – GitHub Profile
Jaap Brasser – PowerShell Gallery

New script Remove-ScheduledTask in TechNet Script Gallery

One of the things that keeps me busy is maintaining the library of scripts I have made available in the TechNet Script Library. Earlier this week I noticed a request for my Get-ScheduledTask script, a script that gets a list containing the scheduled tasks from either the local machine or a remote system. The request stated if it was possible to create a function that could delete scheduled tasks.

Based on this question I had a look at the Get-ScheduledTask script and decided that it requried an additional property in the custom object that it outputs, the computer name. Using both the computer name and the path of a scheduled task I am able to delete scheduled tasks on both local systems as well as remotely.

Here is an example of Remove-ScheduledTask in combination with Get-ScheduledTask:

Get-ScheduledTask-Remove

.EXAMPLE
.\Get-ScheduledTask.ps1 | Where-Object {$_.State -eq 'Disabled'} | Remove-ScheduledTask -WhatIf

Description
-----------
Get-ScheduledTask will list all the disabled tasks on a system and the Remove-ScheduledTask function will list all the actions that could be taken

For more information or the direct download links of these scripts please refer to the links below. Feel free to leave a comment either here or in the TechNet Script Library.

TechNet Script Gallery
My entries in TechNet Script Gallery
Get-ScheduledTask
Remove-ScheduledTask

 

New versions of Connect-Mstsc and Get-OrphanHomeFolder in TechNet Script Gallery

One of the things that keeps me busy is maintaining the library of scripts I have made available in the TechNet Script Library. I get a good number of questions and requests about my scripts there and I enjoy picking out some of the interesting or useful requests to implement them in my scripts. Recently I received some requests for new functionality in some of my scripts so I decided two of my scripts for the latest round of updates.

For Connect-Mstsc I have updated both the PowerShell 3.0 and up version as well as the version that is backwards compatible with PowerShell 2.0. A new parameter has been introduced, -Public, which corresponds with the /public switch of the mstsc.exe tool. It runs Remote Desktop in public mode, which was requested by MSFTW. Here is an example of this switch parameter in action:

.EXAMPLE   
Connect-Mstsc -ComputerName server01:3389 -User contoso\jaapbrasser -Password supersecretpw -Public

Description 
-----------     
A RDP session to server01 at port 3389 will be created using the credentials of contoso\jaapbrasser and the /public switch will be set for mstsc

Get-OrphanHomeFolder has been updated to support wildcards/regular expressions to be able to exclude folders. This came from a request of martin_i who has a lot of folders named .v2 which he would like to exclude instead of manually specifying each path. Here is an example:

.EXAMPLE    
.\Get-OrphanHomeFolder.ps1 -HomeFolderPath \\Server02\Fileshare\Home -MoveFolderPath \\Server03\Fileshare\MovedHomeFolders -ExcludePath '\.v2$' -RegExExclude 
 
Description: 
Will list all the folders in the \\Server02\Fileshare\Home folder and will move orphaned folders using robocopy, excluding folders that end with .v2

For more information or the direct download links of these scripts please refer to the links below. Feel free to leave a comment either here or in the TechNet Script Library.

TechNet Script Gallery
My entries in TechNet Script Gallery
Script to get orphaned home folders and folder size
Connect-Mstsc – Open RDP Session with credentials
Connect-Mstsc – Open RDP Session with credentials (PowerShell 2.0)

New article on PowerShell Magazine: Access remote registry using PowerShell

My latest article on PowerShell Magazine is on how to access the registry on a remote system. This is a technique I have used in a number of my scripts, for example: Get-RemoteProgram. The full article containing tips on how to use the Microsoft.Win32.Registry class is available on PowerShell Magazine : Access remote registry using PowerShell

The following example will retrieve the SubKeyNames of HKLM:\System\CurrentControlSet on the Server1 system:

1
2
3
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,'Server1') 
$RegSubKey = $Reg.OpenSubKey("System\CurrentControlSet")
$RegSubKey.GetSubKeyNames()

Win32RegistryKey

For more articles like this, have a look at the External Articles section of my blog, it contains all the articles I have posted on external sources such as PowerShell Magazine.

Links in this Article
PSTip: Access remote registry using PowerShell
PowerShell Magazine
External Articles
Get-RemoteProgram
My entries in TechNet Script Gallery

 

150000 Downloads: A personal milestone

150000Downloads

Earlier today the counter on my TechNet community profile tipped over from 149,999 to 150,000. A major milestone for me personally as I never expected when I uploaded my first script, Get-FileVersion: Script to check file properties, that I would get this level of feedback. After uploading my first few scripts I remember my excitement when I received my first email from TechNet with a question to one of the scripts. Nowadays I occasionally struggle to keep up with the requests and questions that the scripts generate, and I love the interaction and feedback I have received.

That is also the reason for this post, a thank you to everyone using, breaking and improving my scripts. I have learned a lot and I have revisited some of my ideas on your experiences. It has been very rewarding keeping up with all the developments, suggestions and questions.

I have created a new section on my blog to be able to keep track of the scripts I have released it is available in the top section of this site, Scripts. It contains all the direct links to my script pages and the relevant Q and A sections in the TechNet Script Gallery.

ScriptsSection

In conclusion I would like to thank everyone from participating in discussions that prompted me to write, re-write and re-re-write my scripts for countless iterations and I hope to hear more from everyone in the future!

150,000 Downloads
My TechNet Community Profile
My entries in TechNet Script Gallery
New Script Section

 

Disconnect-LoggedOnUser – Disconnect a RDP session remotely

I created a new function that wraps around the rwinsta commandline-tool to remotely disconnect RDP sessions. I created this function to simplify cleaning up open RDP sessions, for example when an administrator leaves the company there might be disconnected RDP sessions by this user. This scripts works in combination with the Get-LoggedOnUser script to simplify finding and disconnecting these sessions. The script is available for download in the TechNet Script Gallery: Disconnect-LoggedOnUser.

A simple example of how to use this function is as follows:

.EXAMPLE 
Disconnect-LoggedOnUser -ComputerName server01 -Id 5 
 
Description 
----------- 
Disconnect Session Id 5 on server01 

In the next example the output of the Get-LoggedOnUser script is filtered by Where-Object and then piped into the Disconnect-LoggedOnUser script:

.EXAMPLE 
.\Get-LoggedOnUser.ps1 -ComputerName server01,server02 | Where-Object {$_.UserName -eq 'JaapBrasser'} | Disconnect-LoggedOnUser -Verbose 
 
Description 
----------- 
Use the Get-LoggedOnUser script to gather the user sessions on server01 and server02. Where-Object filters out only the JaapBrasser user account and then disconnects the session by piping the results into Disconnect-LoggedOnUser while displaying verbose information. 

The complete function is available in the TechNet Script Library. To view this script or to participate in the discussions about this script either comment here or in the TechNet Script Gallery.

TechNet Script Gallery
My entries in TechNet Script Gallery
Disconnect-LoggedOnUser
Get-LoggedOnUser