Tuesday, September 21, 2004
Another reason to Scriptomatic
Blog EntryBasically you browse many of the WMI classes available and it will create runable scripts for you. Download here: http://www.microsoft.com/downloads/details.aspx?displaylang=en&familyid=9ef05cbd-c1c5-41e7-9da8-212c414a7ab0 It is also worth mentioning a newer Scriptomatic for ADSI. I have not used this one, but if it is half as good as the WMI one, it will be a good utility to have on hand. http://www.microsoft.com/downloads/details.aspx?familyid=39044e17-2490-487d-9a92-ce5dcd311228&displaylang=en Go be a Scriptomanic!!!
Thursday, September 16, 2004
TCP/IP Networking update from the guys over at Microsoft
Anyway on to the good stuff... Here is a new link for Automating TCP/IP Networking on Clients which just got published on the first of September. - Enjoy
Sunday, September 12, 2004
Office Shortcut bar lives!
- First to create the toolbar (this is the easy bit). Just right mouse click a blank section of the Task bar and select Toolbars.
- We then need to navigate to the location of our shortcuts. (With the default install path for Office 2003 the folder you should select is 'C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office')
- This will add an additional toolbar to your Start Menu. At this stage you should make sure the Task bar is unlocked. (Just right mouse click the Task bar and un-tick the Lock the Task Bar option)
- Now using the handle at the start of this new toolbar (handle represented by two vertical columns of little dots.) drag this to the section of the screen you would like your toolbar located. - I would not suggest the right side of the screen as it can cause problems with the scroll bars later if we set the toolbar to auto-hide.
Once you have moved the toolbar to the correct location it should be displaying all the Office icons. We now need to make some touch ups.
- Right mouse click the toolbar and make sure the following preferences are selected if you desire. (Show Title and Text are un-ticked, Always on top and Auto-hide are both ticked.)
- You may also want to resize the toolbar to your personal preference.
Now for the reason I was posting this blog entry in the first place ;-) - The Screen Saver button! Now we need to fire up trusty notepad and run through the following code:
Set oShell = WScript.CreateObject ("WSCript.shell")
Set WMIService = GetObject("winmgmts:")
Set colComputerSystem = WMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
For Each objProperty in colComputerSystem
strUsername = replace(objProperty.UserName, "\","\\")
Next
strWQL = "SELECT * FROM Win32_Desktop WHERE Name='" & strUserName & "'"
Set colDesktopItems = WMIService.ExecQuery(strWQL)
For Each objDesktopItem in colDesktopItems
oShell.run bjDesktopItem.ScreenSaverExecutable
Next
In this script it is just a matter of finding the current user logged on to a Windows system and then looking up that users Desktop settings and running the Screen Saver entry. It's that simple.
So save this file and add it as a shortcut into the folder we have selected for our toolbar. Once this is done you can edit you scripts shortcut and change the icon associated with the script.
WMI Software Development Kit and XP SP2
Saturday, September 11, 2004
Anyone else hate QuickTime trying to control your PC?
I can't think of anything more annoying then when a program keeps registering itself to load at computer startup each time it runs. This is an install option that is at most a once only yes or no answer and then this option should be some where in the options menu for the program if necessary.
QuickTime will keep adding itself into the Registry's Run - "Key path". This is very annoying even if you have Windows XP and can use the msconfig utility (which is a really good utility by the way START > RUN > MSCONFIG - note this was introduced in Windows 98 yet was not made available in W2k for some reason). So here is a little script you can use to avoid QuickTime from loading up in the System Tray the next time you login into Windows after running QT.
The best place to add this script is in the logging off sequence of Windows. That way you don't have to turn the computer off to remove the registry key you just need to log off.
So first the script then i'll show you where to add the file for logging off.
const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
strStringValueName = "QuickTime Task"
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName
Once you have saved the above script to a file eg. c:\scripts\del_quicktime_key.vbs you then need to tell Windows to run the script when you log off.
First Open the Microsoft Management Console (Note this will not work for Windows XP Home). Start > Run > MMC. Then File > Add snap-in > Add > Group Policy > Add > Finish > Close > OK. --- Man I don't remember this process being so long (Note if you find that you want to Edit the Group policy many times you can now select File Save As and save the current arrangement of the console so you do not have to run these steps again). Once you have got the Group Policy just select User Configuration (as we want to do this on a user basis not when the Computer turns off) then select Windows Settings > Scripts (logon/logoff) Open the LogOff option and then select Add then browse to your file and add it into the listing for scripts to run when users logs off.
Now we could have used the registry to do this, yet only the first time we do this would it have been faster. Say we wanted to do the same thing again. Now ee could just do the following:
- Open the Console.msc we created. (When we selected File Save As)
- Select User Configuration
- Windows Settings
- Scripts
- then add the file.
As a rule if you don't have to manually edit the registry (apart from scripts of course) use another method eg. msconfig or another graphical user interface.
MS Scripting Guy's broken link...
Things to do first!
- WMI Scripting Primer - This is a must!
Windows Script (MSDN)
- Microsoft Windows Script Documentation (CHM file for easy access along side trusty notepad)