Archive for category Kix
Associate File Extensions To An Application
Function Associate2($extension,$opencmd)
Dim $rc
;Make sure the dot is specified.
If Left($extension, 1) <> "."
$extension = "." + $extension
EndIf
;Exit if a required parameter is empty.
Select
Case $extension = ""
Exit 87
Case $opencmd = ""
Exit 87
EndSelect
;Create the values for the open command.
$rc = WriteValue("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" + $extension + "\", "Application", $opencmd, "REG_SZ")
EndFunction
Associate2(".kix","Notepad.exe")
Associate2(".WhateverExtensionName","WhateverApplication.exe")
Call Kix Script From A Batch File
Place the Batch File into the Netlogon/Sysvol Share
%0\..\kix32.exe %0\..\Scriptname.kix
Add Or Delete Printers
If DelPrinterConnection (“\\Server\Lab“)=0
? “Deleted Printer ….”
EndIf
If AddPrinterConnection (“\\Server\Lab“) = 0
? “Added Printer ….”
EndIF
Write To The Registry
Example – WriteValue(“key path”, “value”, “data”, “data type”)
WriteValue(“HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Cached”, “{A4DF5659-0801-4A60-9607-1C48695EFDA9} {000214E6-0000-0000-C000-000000000046} 0×401″, “1″, “REG_DWORD”)
Map Network Drive Based On Active Directory Group
IF INGROUP(“AD Security Group Name”)
USE H: /DEL
USE H: “\\Server\Home$\%username%” /persistent
ENDIF
Configure Outlook With PRF File
“Check if PRF has already been applied” ?
$olprof = ReadValue(“HKey_Current_User\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles”, “DefaultProfile”)
If $olprof = “MyPRF_Name_2003″
Else
If $olprof = “MyPRF_Name_2007″
Goto “Exit”
EndIF
“Checking Outlook Version” ?
Sleep 1
$olpath = ReadValue(“HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE”, “Path”)
$olversion = GetFileVersion($olpath + “outlook.exe”, “ProductVersion”)
;Region Create Outlook profile
;Set profile to import
Select
Case Left($olversion, 2) = “11″
“Outlook 2003 PRF Selected” ?
$rc = DelValue(“HKCU\Software\Microsoft\Office\11.0\Outlook\Setup”, “First-Run”)
$rc = WriteValue(“HKCU\Software\Microsoft\Office\11.0\Outlook\Setup”, “ImportPRF”, “@LServer\NETLOGON\MyPRF_Name_2003.prf”, “REG_SZ”)
“Outlook 2003 PRF Set” ?
Sleep 2
Case Left($olversion, 2) = “12″
“Outlook 2007 PRF Selected” ?
$rc = DelValue(“HKCU\Software\Microsoft\Office\12.0\Outlook\Setup”, “First-Run”)
$rc = WriteValue(“HKCU\Software\Microsoft\Office\12.0\Outlook\Setup”, “ImportPRF”, “@LServer\NETLOGON\MyPRF_Name_2007.prf”, “REG_SZ”)
“Outlook 2007 PRF Set” ?
Sleep 2
EndSelect
;Endregion
:Exit
Remove Specific Outlook Internet Account Based On POP3 Server Name
“Script Started” ?
$Count = 00000000
$olkey = “HKey_Current_User\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676″
“Checking Outlook Account Reg Keys” ?
Sleep 2
$olcheck = EnumKey ($olkey,$Count)
While @ERROR = 0
$olpop = ReadValue($olkey + “\” + $olcheck, “POP3 Server”)
If $olpop = “70006f00700033002e006400690067006900740061006c0069006d0073002e006e00650074000000″ -> This is Binary Specific to the POP3 Server name. Get this info from the Registry at the HKCU Path above
“Found POP3 Account” ?
Sleep 1
“$olpop” ?
Sleep 2
“$olcheck” ?
Sleep 5
DelKey($olkey + “\” + $olcheck)
“Deleted POP3 Account from Reg” ?
Sleep 1
EndIf
$Count = $Count + 1
$olcheck = EnumKey ($olkey,$Count)
Loop