New versions of scripts and a new script in the TechNet Script Gallery

After attending the PowerShell Conference Asia this weekend in Singapore I realized I did not update my scripts in the TechNet Script Gallery for a while, so I took some time to go through the feedback and feature requests for my scripts. I found out that there was some work to be done on a number of my scripts and I got started with it.

First of all I started with the The Get-ScheduledTask script, I added in the ComputerName from which the tasks are gathered in the output. This was done to ensure that the script functions as expected when used in combination with the Remove-ScheduledTask script. Additionally I also included the triggers in the output as requested by Profile787.


The Remove-ScheduledTask script is able to remove scheduled tasks and supports pipeline input from the Get-ScheduledTask script:

Remove-ScheduledTask -ComputerName JaapTest01 -Path '\Folder\YourTask' 
Will remove the YourTask task from the JaapTest01 system 
.\Get-ScheduledTask.ps1 | Where-Object {$_.State -eq 'Disabled'} | Remove-ScheduledTask -WhatIf 
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

Get-OrphanHomeFolder, there were two requests for new functionality and because of that I introduced two new parameters:

  • SearchBase
  • CheckHomeDirectory
This parameter determines what the SearchBase for the AD query is, the LDAP path for an OU should be specified here. This can be used to limit the AD Query to a sub tree within Active Directory

.PARAMETER CheckHomeDirectory
Setting this switch parameter will check the full path of the folder against the HomeDirectory attribute of an ADObject, when using this switch make sure that the correct shared folder or DFS path is used, otherwise output can be unreliable

.\Get-OrphanHomeFolder.ps1 -HomeFolderPath \\Server01\Home -SearchBase 'LDAP://OU=YourOU,DC=jaapbrasser,DC=com'

Will list all the folders in the \\Server01\Home path. For each of these folders it will query AD, only in the YourOU Organizational Unit of the JaapBrasser domain, using the foldername

.\Get-OrphanHomeFolder.ps1 -HomeFolderPath \\dfs\share\userfolders\ -CheckHomeDirectory

Will list all the folders in the \\Server02\Fileshare\Home folder and check against the homedirectory attribute of the AD objects

The Get-UnchangedPwdlastset script has also been updated, as one of the default values was being added instead of subtracted from the result as noted by Richard Mueller.Finally the last script that has been updated is the Get-LoggedOnUser script. Apaladi correctly noted that with certain regional datetime settings it would be possible for the script to truncate the data incorrectly.

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 scheduled tasks from remote computer
Remove Scheduled Tasks from remote computer
Script to get orphaned home folders and folder size
Query for AD Users that have not changed password for x-days
Get-LoggedOnUser Gathers information of logged on users on remote systems

Leave a Reply