PowerShell: AD Workstation Cleanup Script version 2.0 « Trevor Sullivan’s Tech Room

 

A little while ago, I posted a PowerShell script that detects old machine accounts in Active Directory, and disables or deletes them, based on certain ages (in days). I’ve continued work on this script, such that it now logs information to Excel about actions (disable or deletion) that it takes. This requires that Excel 2007 be installed on the computer which you are running it on; I have not tested the script with other versions of Excel. I haven’t really made the script very user friendly (eg. taking command-line parameters) yet, because I have pretty much been the sole user of it, so please keep this in mind.

PowerShell: AD Workstation Cleanup Script version 2.0 « Trevor Sullivan's Tech Room

Hey, Scripting Guy! Blog : Hey, Scripting Guy! What Are the New Cmdlets in Windows PowerShell 2.0?

 

The number of cmdlets in Windows PowerShell 2.0 has nearly doubled over the number that shipped with the original product. These are core cmdlets and do not take into account the number of cmdlets that are included with Windows 7.0. Many of these cmdlets are for use with remoting, and the underlying WSMan technology. On a Windows 7 computer with Microsoft Remote Server Administration Tools (RSAT) installed, there are 456 cmdlets. On a Windows 7 computer with all modules loaded, but without RSAT installed, there are 251 cmdlets. On a Windows 7 computer without the modules loaded there are 236 cmdlets. On a computer with Windows PowerShell 1.0 installed and with no snap-ins installed, there are 129 cmdlets.

Hey, Scripting Guy! Blog : Hey, Scripting Guy! What Are the New Cmdlets in Windows PowerShell 2.0?

Allowing PowerShell to Query Remotely through a GPO

If you want to query remote computers' WMI properties on your network using PowerShell, this quick GPO setting can open the proper ports on the remote workstations.

Creating a new GPO at the domain level:

  1. Under the Local Computer Policy heading, double-click Computer Configuration.
  2. Double-click Administrative Templates, Network, Network Connections, and then Windows Firewall.
  3. If the computer is in the domain, then double-click Domain Profile; otherwise, double-click Standard Profile.
  4. Click Windows Firewall: Allow remote administration exception.
  5. On the Action menu, select Properties.
  6. Click Enable, and then click OK.

PowerShell Script to Retrieve the Laptop’s Battery Status

Use this PowerShell script to learn about a laptop's battery status.

Copy and paste from between the lines.

=============================

$computer = "LocalHost"
$namespace = "root\WMI"
Get-WmiObject -class BatteryStatus -computername $computer -namespace $namespace

=============================

Information retrieved:

Active
Caption
ChargeRate
Charging
Critical
Description
DischargeRate
Discharging
Frequency_Object
Frequency_PerfTime
Frequency_Sys100NS
InstanceName
Name
PowerOnline
RemainingCapacity
Tag
Timestamp_Object
Timestamp_PerfTime
Timestamp_Sys100NS
Voltage

PowerShell CTP3 Release News | TechProsaic

 

In case you missed PowerScripting Live last night, Jeffrey Snover announced that PowerShell CTP3 was going to have been released today (Dec 19th).  Ewwww, yes, past tense on that one.  Turns out there is a possible showstopper bug that the team is investigating right now. He promised that they’ll be shipping the latest tech preview version of PowerShell as soon as they possibly can.

PowerShell CTP3 Release News | TechProsaic