I create a lot of Excel audit reports in a multi-domain environment. When they go out, I need to combine the reports from each domain into a single Excel workbook with multiple worksheets. I found some VBA code on mrexcel.com which was pretty easy to port to vbscript. I put the script on the desktop and then select all of the files which I want combined, and drop them onto the script. A new workbook opens with each of the original files as a worksheet page. The original files are not deleted. Note that if you line the files up in the order you want them before selecting them, you will get them in the order you want. I hope you find CombineXLSheets.vbs makes this task a little easier.
WindowsUpdate.hta version 3.1 is an HTML application which allows you to connect to a remote machine, determine what patches it requires from Windows Update, and install the patches. You can schedule a reboot time. This version allows you to look at he Windows Update log, and the log created by the program itself. There is a button to allow you to change the update source to windowsupdate.com, which is helpful in places where WSUS or SUP is not working properly. You can install all security patches, or select patches individually.
HTA files are best run from your local drive. Version 3.0 was released in 2011, version 3.1 only changes the background color to blue. The transition color method I had used for the background is no longer supported in IE, and the program appeared to be broken.
Change _hta.txt extension to .HTA.
Getting the DN for an individual computer is not a difficult task in PowerShell, ex:
Import-Module activedirectory $(Get-ADComputer $env:COMPUTERNAME).distinguishedName
Doing this fast for a long list of machines in a big forest is less easy. Get-ComputerDN.ps1 gets the distinguished name of a list of computers using WorkFlows. I spent some time trying out how to figure out the best way to do Active Directory Global Catalog searches in an Active Directory forest with many domains, such as level2.level1.root.com. I don’t want to query root.com when I know that the computer account exists under level1.root.com. Similarly, I don’t want to query outside my domain, level2.levels1.root.com when I know the computer account exists there.
What this script did for me was to get some hands on with parallel processing using workflows and to help me to decide how I want to manage Global Catalog queries in the future. The original version of this script looked pinged the computer name and looked for the DN. This version is much more sophisticated. If you give it a list of NetBIOS names it will figure out the FQDN based on the LDAP query. It will figure out the closest Global Catalog Server for the domain you are querying by using the ping response time. I am using ParameterSetName to manage the choice of the domain level to query. You can see from the commented code I default to the forest, but let the user select the current domain or the parent domain. I also accept either a computer name or a file path as input. Unlike prior versions, the script will always ping the computer even if it is not in AD. It requires PS Version 3.
Updated: 1/30/14 to fix ping problems. 2/15/14 major rewrite.
I can only guess that BitDefender is trying to make itself look good by falsely identifying cookies as malware. They may be annoying, they may affect your privacy, but they aren’t “infected”. Crap like this will make me buy a from a different vendor next time.
I have a couple of PowerShell scripts which I run daily, and the number keeps growing. I wanted a quick way to run scripts which support alternate credentials. Drag and drop a PowerShell script onto the RunPS.cmd batch and you are prompted to run with it with your current credentials, alternate credentials, using RunAs, or SmartCard authentication. If you drop a shortcut to a script onto it, the batch file will find the target and launch that by creating a temporary vbscript on the fly.
Do you have a script that worked with your x32 XP computer, but no longer works in Windows 7 or 8 x64? I am finding that some of the scripts I wrote have this problem. Somethings may rely on an ActiveX control that was native to XP but not a later version. What I am finding is that I have some scripts, such as this fragment fail:
Set OConnMDB = CreateObject("ADOX.Catalog") OConnMDB.Create _ "Provider = Microsoft.Jet.OLEDB.4.0; " & _ "Data Source = " &dbName Set OConnMDB = Nothing
A quick fix for this is to run the script with the X32 version of cscript or wscript. You can try running the scripts with c:\windows\SysWow64\cscript.exe. Otherwise, back to the debugger.
I have had to fix a couple of recent posts because the PowerShell scripts failed to work as I thought they would. Which is weird, because I test them before releasing them. What I had not noticed is that you can set a variable in ISE that will be remembered through the session. An example is a problem I had with the second version of Get-ComputerDN.ps1. A co-worker downloaded it and told me that the ping function (not optional in the newest version) wasn’t working. This was odd, because I had tested it myself.
Running it through the debugger, I found that I had a variable in a prior version that I failed to set in the new version. But because it had been set in the original, I failed to notice that it did not work before posting. There are scripts floating around on the Net to clear the variables, but my practice is going to be close the ISE and reopen to test before publishing.
If you do find something that doesn’t work, drop me a note so I can fix it. My email address is in all my scripts.