Your company's ad could live here and reach over 50,000 people a month!

Author: Ying Li

PowerShell script to create AD accounts (II)

In my previous post, I blogged about how to create AD accounts using PowerShell and Quest PowerShell commands for AD. Below is a similar script with some modifications. What happens you get a csv file which doesn’t have a name column but have lastname, firstname etc. You want to create the AD accounts with certain format such as test_lastname. We just need some concatenations. import-csv Use...

PowerShell script to collect server inventory

$erroractionpreference = "SilentlyContinue" $a = New-Object -comobject Excel.Application $a.visible = $True $b = $a.Workbooks.Add() $c = $b.Worksheets.Item(1) $c.Cells.Item(1,1) = "Organization" $c.Cells.Item(1,2) = "Server Name" $c.Cells.Item(1,3) = "Operating System" #$c.Cells.Item(1,4) = "IP Address" $c.Cells.Item(1,4) = "Service Packs"...

PowerShell script to get remote registry key property

The first half of the below script is a modified version of my previous post, it just translate the BITS version to the popular format we know and remember. The second part of the script is to use a get-remoteregistrykeyproperty.ps1 written by Lee Holmes in his Windows PowerShell Cookbook. I believe that’s so far the cleanest way to get key value from remote registry. Of course the hard work...

PowerShell Script to create new registry key value on remote computers

In this post, I explore the ways to get remote registry key property. Here is a PowerShell script to create a new registry key value in remote registry. $colComputers = gc c:\myworkspace\computerlist.txt foreach ($strComputer in $colComputers) { #Open remote registry $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(‘LocalMachine’, $strComputer) #Open the targeted remote registry...

PowerShell script to update DNS Search Order on a particular NIC on multiple remote machines

Here is a PowerShell script to update DNS Search Order on a particular NIC on multiple remote machines $cred = get-credential $strDNSServers = "192.168.1.50", "192.168.1.51","192.168.1.52" function Update-DNS { $Nic = Get-WMIObject Win32_NetworkAdapter -comp $strComputer |where{$_.NetConnectionID -eq "Local Area Connection"} $Config = Get-WMIObject Win32_Net...

PowerShell to help Web Site Launch – Multiple Host Headers on Multiple Web Servers

Quite often I receive requests to launch a website with multiple domain names and they will need to work with or with out www such as whatever.com and www.whatever.com. The site need to be launched on NLB cluster nodes. I got the contents from developers and copy them over to the production web servers and make necessary configurations – routine stuff. But if the request is multiple domain names t...

PowerShell script to find all the .admin users in AD

Let’s say every user (in IT) has two accounts – one is their regular user account and the other is their admin account. It could be in the form of xyz.admin(or any other format). How you go about searching your active directory and find all the .admin accounts? it couldn’t be easier than this: Get-QADUser -ldapFilter ‘(SamAccountName=*.admin)’|export-csv admins.csv Of...

PowerShell script to list installed software on local computer

As you might guessed, the best place to find currently installed software is from the place that stores information about how to uninstall it – the HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall registry key. Here is a PS script to list installed software on a local machine – you could add more propertites as you deem approriate $a = New-Object -comobject Excel.Application $a.visible = ...

PowerShell Script to Take Snapshot on Multiple VM Machines

In my previous Blog, I introduced some basics about VMWare Infrastructure Toolkit. Now let’s put it into action! Let’s say you have a test MOSS or SMS virtual environment, you have a couple of servers and you configured everything and test everything. Before you make the next big change, you may want to take a snapshot of your machines so you can have some to fall back on if something ...

VB Script to check on McAfee EPO Exclusions

Here is a VB script to check and verify the McAfee On Access Scan Exclusions on multiple machines and write the results to txt files. I am doing VB script because my current job(production) environment don’t have PowerShell installed yet. But I have to say this is not a very pleasant experience after I already used to the PowerShell way of thinking. Just look at how “complicated” to write the outp...

PowerShell Script to Restart multiple Remote Computers

  gc c:\Temp\ServerList.txt |%{Restart-computer –computername $_ –force} It gets a list of computers and force the immediate restart! It’s very handy and also can be very dangerous, you could potentially reboot every single computer in your company! Get-QADComuter|%{Restart-Computer –computername $_ –force –throtllelimit 1-}

PowerShell script to check Windows Installer (msi.dll) version

Let’s say you need to find out the Windows Installer version on multiple remote machines. If you have SMS in place, this should be an easy task. You can create a dynamic query collection. But what happens if you don’t have SCCM in your environment? I wrote a PowerShell script to accomplish this task. Query remote computer for msi.dll (this applies to any interested files) fileversion. $erroraction...