Archive for the ‘Scripting’ Category

PowerShell Confirm Preference (2010-3-4)

I seem to run into an issue when I run some PowerShell scripts where I get prompted at each line of the script for confirmation.  That can get really annoying, so I have to look up how to prevent that behavior.  Thankfully, there is already some good information out there on how to do [...]

Servers in Domain (2010-2-24)

At some point, I had a desire to list all the computer accounts for any server OS in Active Directory.  I am pretty sure that I did a search and found the script below, but I don’t remember where, so whoever wrote it doesn’t get credit this time…
$strCategory = “computer”
$strOperatingSystem = “Windows*Server*”
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher [...]

Using XML in your PowerShell scripting (2009-9-22)

I have written a lot of scripts that use .txt files to read or store data, but I have a need to read some information from an .xml file.  This could be done by treating the file as a simple txt file, but it would require some pretty good filtering that is already a part [...]

Monitoring drive space (2009-9-4)

One of the things that we spend a lot of time on is trying to keep track of what servers have enough free space.  We have a lot of different tools to check drive space, and we even use some of them from time to time.  We have a pretty complicated system created by Rickey [...]

Another Registry Script… (2009-3-11)

I have the unfortunate need to occasionally fix things in the registry, mostly related to applications running in a Citrix environment.  I believe there are nice tools out there that are supposed to do this for you, if given the right information, but I haven’t bothered to figure out what those tools are or how [...]

Reading a Unicode text file using VB Script (2007-9-7)

 I was looking for something else and came across this in the Scripting guy archives…
Set objFile = objFSO.OpenTextFile(“c:\scripts\test.txt”, ForReading,False,TriStateTrue)
The first two parameters probably don’t faze you much: they’re simply the full path to the file we want to open and the constant ForReading. And you’re right: this is standard operating procedure when it comes to [...]

Unicode isn’t friendly to vbscript (2007-8-29)

I was trying to write a script to read a text file and evaluate the data to do some formatting on it.  This is for a project I am working on and the person that gave me the text file wants some changes made based on the contents of the file.  I have done similar [...]

List All Folders in the User Profile Directory (2007-7-10)

I wanted to be able to remotely connect to a server and see if it had a profile directory for a particular user.  I wrote a VBScript that will connect to a machine through WMI, find out what the ProfilesDirectory path is and then list all the folders in that directory.  It wouldn’t take much [...]

Deleting things from the Registry (2006-8-9)

So… the other day I was working on a script.  I had a need to delete several registry Subkeys under one key.  I hadn’t really figured out how I was going to go about it, but I happened to pick up a copy of TechNet Magazine on my desk and see at the bottom “Scripting [...]

Do you want to be a Scritping Guy? (2006-8-9)

Microsoft’s Script Center has a “funzone“ that has a weekly scripting puzzle.  I haven’t tried it yet, but it would seem like a good way to get some practice scripting. 
http://www.microsoft.com/technet/scriptcenter/funzone/puzzle/default.mspx