Archive for July, 2011
Disabling Windows Search as your Default Search Program
I have many windows 2003 servers that for one reason or another need to have Windows Search installed. I don’t like windows search, I much rather use the classic search or a nice little program called Agent Ransack
If you already have Windows Search Installed, when you press Ctrl+F3 you get Windows Search to come up, but thanks to the John @ John’s Adventures Blog I found a nice little solution that works to restore the classic search and I thought I’d share it with everyone
by Setting the Registry Key HKEY_CURRENT_USER\Software\Microsoft\Windows Desktop Search\DS\ShowStartSearchBand to 0, when you press Ctrl+F3 you get the classic search again. To put things back, just set the key back to 1
There is also a “Local Machine” key located at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Desktop Search\DS\ShowStartSearchBand. This key disables desktop search from coming up on the entire server, but I much rather disable it for my own user ID, and let anyone who likes Windows Search to keep using it.
Search On!!
Replace Default NetScaler Certificate for the Management GUI
If you have a Citrix Netscaler and you need to manage it, you have to connect to the NetScaler IP (NIP) with a browser. But if you try to connect to it via HTTPS either with IE or Firefox you will get an “Invalid Certificate” Error.
Trying to follow the instructions in the Citrix Article (CTX122521) “How to Replace the Default Certificate of a NetScaler Appliance with a Trusted CA Certificate that Matches the Hostname of the Appliance” is just too cumbersome, and I knew there had to be an easier way to do it via the GUI, and there is:
Note:
Before we start I am assuming you already have a certificate installed in the NetScaler, either a cert that matches the host name of the NetScaler or a Wild Card cert
If you dont know how to install a certificate on the NetScalers, I suggest you read these article
– How to Generate and Install a Public SSL Certificate on a NetScaler Appliance (CTX109260)
– How to Transfer Certificates from IIS to the NetScaler(CTX109031)
- Log into your NetScaler using an account with “superuser” powers (nsroot, etc)
- Expand the “Load Balancing” Tab and click on “Services”
- On the right side under services click the “Internal Services” tab
- Highlight the “nshttps-127.0.0.1-443” service and click the “Open” button
- In the “Configure Service” window, click the “SSL Settings” tab
- Under the “Configured” certificates you will see the default “ns-server-certificate”, highlight it and click the “Remove” button
- Under the “Available” certificates, highlight the certificate you want to use and click the “Add” button (in my case, the “Pinchii Wildcard SSL Cert” from Godaddy)
- Hit “Ok” and close out of that window
- Repeat the same procedure for “nsrpcs-127.0.0.1-3008” and “nsrpcs-127.0.0.1-3009” as these are the “services” used when you configure the NetScalers using the “Web Start Client” Java App
- Hit “Save” and then “Refresh All” to save your new configuration to the NetScalers
Thats it, now next time you try to login to your NetScalers with a HTTPS connection you will have a valid SSL cert and you should have no warnings or problems with IE or Firefox
Updating Scheduled Tasks Via VB Script
So I found myself in a situation where I needed to update over 100 scheduled tasks and I really did not feel like doing them by hand, so I thought I’d create a script that would update them for me.
Here is what i came up with:
Thats pretty much it, Out of about 200 scheduled tasks this script found and updated about 105 of them that needed to be changed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
<span style="color: #339966;">'create your shell object </span>Set objShell = WScript.CreateObject("WScript.Shell") <span style="color: #339966;">'create the environment varaible ojbect </span>Set varEnv = objShell.Environment("Process") <span style="color: #339966;">'set Temp to varTemp </span>varTemp = varEnv("TEMP") <span style="color: #339966;">'now lets read in all the scheduled tasks in the system </span>On Error Resume Next cmdResult = objShell.Run("%comspec% /c schtasks /query /v /nh /fo CSV >" & varTemp & "\schtasks.txt", 1, true) Select Case Err.Number Case 0 <span style="color: #339966;">'no error </span>Case Else msgbox "Error Reading Scheduled Tasks" Wscript.Quit End Select On Error Goto 0 <span style="color: #339966;">'Ok so we have the file created with the scheduled tasks, lets read it into the script 'Create the file system Object</span> set objFSO = CreateObject("Scripting.FileSystemObject") <span style="color: #339966;">'Open the File with the schedule task info we created earlier </span>set schTasks = objFSO.OpenTextFile(varTemp & "\schtasks.txt", 1, false) <span style="color: #339966;">'read the file into memory </span>schContent = schTasks.ReadAll <span style="color: #339966;">'close the file </span>schTasks.close arrSchTasks = Split(schContent, vbCrLf) For Each strTask in arrSchTasks <span style="color: #339966;">'If the word "\batch\\" is found, then process the string</span> If (InStr(1,strTask,"\batch\",1) <> 0) Then <span style="color: #339966;">'schTasks /Query will return commas in the date field, this is a good way to split the CSV (",") </span> arrTask = Split(strTask,Chr(34)&","&Chr(34)) <span style="color: #339966;">'this is an extra check to make sure the array is not empty for some reason (if it was, it would return -1) </span> If ubound(arrTask) > 0 then varTaskRun = Replace(arrTask(9),"\batch\","scripts\",1,-1,1) On Error Resume Next <span style="color: #339966;">'Now that we edited the text we needed, lets write it back to the Task List</span> <span style="color: #339966;"> 'Make sure you set RU and RP with YOUR user name and Password for the account that runs your scheduled tasks </span> cmdResult = objShell.Run("%comspec% /c schtasks /change /RU Pinchii\taskman /RP Password123 /TN " &Chr(34)&arrTask(1) &Chr(34)& " /TR " & Chr(34) & varTaskRun & Chr(34), 1, true) Select Case Err.Number Case 0 <span style="color: #339966;">'no error </span> Wscript.Write "Updated " & arrTask(1) Case Else msgbox "Error Setting " & arrTask(1) End Select On Error Goto 0 End If End If Next |