Skip to main content

Tag: Scripts

Script to Move All Disabled AD Objects to a Specified OU

The title says it all. This script will move all disabled AD objects to a specified OU. This script accepts parameters that will allow you to specify whether you want to move Users or Computers and the destination OU. It also accepts a “test mode” parameter that will run the script and output the results, without actually modifying Active Directory. This is revision 1 of the script. There are still several improvements I would like to make, including better error handling and recovery.

Script for Setting the License for Multiple Office 365 User Accounts

A script for setting the Office 365 license for multiple users. Requires a CSV file named users.csv. This file must in the same directory as the script. The CSV file must contain three columns. The title of the columns should be UPN, UsageLocation, and SKU. BulkSet-MsolUserLicense.ps1

Script for Querying All AD Computers Time Source

This script will iterate through all computers in Active Directory and return the configured time server for each computer. <# .SYNOPSIS Get time source for all computers in domain .EXAMPLE Get-TimeSource .NOTES Author: Ryan Nemeth - RyanNemeth@live.com Site: http://www.geekyryan.com .LINK http://www.geekyryan.com .DESCRIPTION This function will iterate through all computers/servers in a domain and return the time source for each. #> Write-Host -foregroundcolor Red -BackgroundColor black "This script must be run on a domain controller and requires that the AD Powershell module be installed" $module = Get-Module -ListAvailable | Select-Object -ExpandProperty Name if($module -notcontains "ActiveDirectory") { Write-Host -foregroundcolor red -backgroundcolor black "***Active Directory Powershell Module Not Found***" } else { Write-Host -foregroundcolor yellow "Found Active Directory Powershell Module.

Ping Sweeping with FPing

I generally use NMAP for any type of host discovery, but recently started experimenting with FPing. One thing I found is that, when performing a ping sweep, not only do I see the hosts that replied to the ping, but FPing also sends any unreachable IP addresses to stdout (which is super annoying and ugly if you ask me…). Anyway, after a bit of research, I found a nifty way to suppress these messages.

Powershell: SID to Username

This is a simple script to convert a SID to a username # Returns a username based on a SID # Author: Ryan Nemeth # Date: 12/2/2014 $SID = read-host “Please enter the SID: ” $object = New-Object System.Security.Principal.SecurityIdentifier($SID) $User = $object.Translate( \[System.Security.Principal.NTAccount\]) write-host “The user is: ” $User.Value