KiXtarting Your Scripts - ' KiXtart Basics ' (
Page 2 of 3 )
A domain administrator's to-do list on any given day may look something like this:
Map user shares at login
Run hardware and software audit
Install the new corporate wallpaper
Deploy new corporate templates
And do it all transparently to the users.
ADVERTISEMENT
Simple, right?
It is, if you use the administrator's secret weapon: a login script.
Windows login scripts are executed (surprise) when a user logs in, and run with the same privileges as that user (for tasks requiring administrator privileges, you'll need to use a Startup script). They automate tasks like those mentioned above, and as long as the script isn't too long, the user doesn't even know anything untoward is happening; his drive mappings and such just appear like magic.
The trick is learning to program that magic.
Windows does provide some integrated scripting tools, such as VBScript, but today we're going to look a free (actually CareWare) scripting tool developed by Ruud van Velsen, a Microsoft Netherlands employee. The downloadable KiXtart is an easy-to-learn free-form scripting language that does virtually everything an administrator needs.
VBScript is a general-purpose scripting language. However, KiXtart was designed for logon scripting — though it is evolving into a more general-purpose language — so it contains simple commands for functions that would take several lines of code to perform in VBS. Here's an example of the difference in mapping a drive in VBS and KiXtart:
VBS/WSH:
Set WSH = Wscript.CreateObject("Wscript.Network")
WSH.MapNetworkDrive "H:", "\\Server\Home"
KiXtart:
USE H: "\\Server\Home"
One line versus two, 22 characters versus 89. Which would you rather type?
KiXtart contains more sophisticated constructs, as well. For example, say you need to check whether a particular Registry key is present, and if it is not, add it. An "If KeyExist" statement, followed by "AddKey" will do the trick. Here's an example that adds the closest Exchange Global Catalog into the Registry:
If KeyExist ('HKEY_CURRENT_USER\Software\Microsoft\Exchange\Exchange Provider')
AND NOT KeyExist
('HKEY_CURRENT_USER\Software\Microsoft\Exchange\Exchange Provider",
"Closest GC","1","REG_DWORD')
WriteValue ('HKEY_CURRENT_USER\Software\Microsoft\Exchange\Exchange Provider",
"Closest GC","1","REG_DWORD')
Else
EndIf