I was reviewing my blog stats today and found a link from a site in UK to my version of ScriptoMatic.hta. I have upgraded my home laptop to 8.1, and decided to see whether it still works (it does). If you launch the “fixed” ScriptoMatic as an ordinary user, it takes a very long time to load. But after it did, I found that it worked just fine. I began reviewing the WMI classes listed, and found one that I had not noticed before, Win32_ReliablityRecords. This class, introduced in Windows 7, gives you a list of failed installs, system hangs, and application crashes in an easy to read format.
Scriptomatic created a nice vbScript to enumerate the class. I coded Get-ReliablityRecords.ps1 in PowerShell with one-third the lines including comments. It has only basic parameters. You may choose a remote computer and a limit on the records returned.
I frequently get a request to delete a list of computers in my AD domain. Often the list is in an email. Delete-PCListFromClip.ps1 is a short script which reads the content of the clipboard, then sends the list to Out-Gridview for review. You may then select the computer names for deletions. PowerShell 3.0 and the ActiveDirectory module are required.
I’ve updated one of my favorite and most used PowerShell Scripts, Convert-ADValues. Read the revised post, here.
I thought that the Windows Experience Index was pretty useless until I wanted to compare the speed of systems that I was preparing to donate. One had Windows 7, the other was a lab PC running Windows 8.1. I was surprised to find that I could not find the Windows Experience Index (WEI) on the Win 8.1 computer. The WEI is calculated by Windows using the Windows System Assessment Tool (WSAT), (see: http://en.wikipedia.org/wiki/Windows_System_Assessment_Tool for a good overview). The attached script requires PowerShell 3, and so run natively on Windows 8 and 8.1. What it does is permits you to see your current WEI for your Windows 8.1 computer. This is written for people with an understanding of PowerShell. If you have your execution policy set to unrestricted, you may find that Get-WINSATScore.ps1 is easiest to run from the ISE.
Written to replace DelProf, this script deletes inactive user profiles from a local or remote computer. It supports arguments by position, and has a test parameter. If you run it locally, you may supply host name, localhost or “.” The logfile is tab delimited, you may use XLS extension to open in Excel. If you run the script interactively the log opens when the action is complete. This is written to be loaded with “dot sourcing”, ex:
PS C:\>. "c:\mypsscripts\Delete-InactiveProfiles.ps1"
After you have loaded the module you can use Get-Help Delete-InactiveProfiles.ps1 for more information on syntax.
Delete-InactiveProfiles.ps1 is heavily commented so you can see what it is doing. I am using WMI to get the list of local users, and query NTUser.DAT for last logon time. Remember to rename from Delete-InactiveProfiles_ps1.txt to Delete-InactiveProfiles.ps1.
Someone asked me whether I could pull the email address of a user from an inserted SmartCard. I knew I could dump the information in Windows 7 using the CertUtil command and wanted to experiment with parsing information with PowerShell. The code can be very compact:
$certInfo = certutil -scinfo -silent | Select-String -Pattern "RFC822" | Get-Unique
$UPN = $certInfo.ToString().Replace("SubjectAltName: RFC822 Name=","").trim()
In the first line the command output from certutil -scinfo -silent is piped to Select-String. The pattern pulls out lines with “RFC822″. Since we all know that the RFC822 Name
is the email address we are pulling out lines with that info from the output. Then we select unique results only. Happily that gives us one line with the email address together with the other information on the line. In line 2 we are using Replace to delete the extra text, and Trim to remove the leading and trailing spaces. All in all, a pretty neat demonstration of the power of PowerShell.
So, I wrote a pretty cool script and sent it to a co-worker. I wrote it on a Windows 7 PC with the RSAT tools installed. My friend tried to run it on a 2008 R2 server with PowerShell 3.0, but the ActiveDirectory module would not load. I tried to edit the script, but ISE would not load. After some research, I found a couple of one-liners:
#Installs AD Module and ISE on 2008 R2 server
For me the RSAT tools required a reboot. It is not clear to me whether the ISE also requires a reboot.