joeware - never stop exploring... :)

Information about joeware mixed with wild and crazy opinions...

7/8/2010

Some possibly useful batch commands

by @ 10:31 am. Filed under tech

I had to work out a few things to do in a batch file the last couple of days so I thought I would share. Note: so this doesn’t become a huge powershell versus perl versus whatever discussion, I had no choice, I had batch available period and even that was possibly stretching it a little as the people involved seemed very concerned about scripts, etc. Also, yes I am aware of Tim–Toadie (TIMTOWTDI). So please feel free to comment with additional methods.

 

Getting date and time in a useful format

for /f "tokens=1-4 Delims=/ " %%i in (‘date /t’) do  set dt=%%l/%%j/%%k
for /f "tokens=1" %%i in (‘time /t’) do set tm=%%i
echo Date: %dt%-%tm%

 

Is this machine virtual or physical? It could be VMWare, HyperV or Virtual Server or Virtual PC. I don’t have the strings for other virtualization techs, if people are using them and can post the results of the command “wmic computersystem get model” then they can be added to the batch commands.

set VIRTUAL=NO
set VMWARE=NO
set HYPERV=NO
for /f "skip=2 tokens=1-2 delims=," %%i in (‘wmic computersystem get model /format:csv’) do set MODEL=%%j

: Microsoft Virtualization
if "%MODEL%"=="Virtual Machine" (
  set VIRTUAL=YES
  set HYPERV=YES
)

: VMWare Virtualization
if "%MODEL%"=="VMware Virtual Platform" (
  set VIRTUAL=YES
  set VMWARE=YES
)

 

Is this machine Vista or better?

SET VISTA+=NO
if exist %systemroot%\system32\bcdedit.exe set VISTA+=YES

 

Is this machine x64?

SET x64=NO
if exist "%systemdrive%\program files (x86)" set x64=YES

Rating 4.00 out of 5

6/28/2010

.NET… Love your idiosyncracies… not

by @ 2:50 pm. Filed under tech

So I am forced to write some more .NET code, worse, some Windows Forms stuff. Couldn’t put me further away from my happy zone. I do have to say that Borland err, CodeGear Builder C++ still blows VS away for simple generation of GUI. If only CodeGear did x64…

 

So two things that I have found I am unhappy about in just the last hour.

  1. RefreshCache() doesn’t appear to work for the LDAP provider in DirectoryEntry. WTF.
  2. CTRL-A isn’t captured and used for SELECT ALL by default in a TextBox. I actually had to code a workaround for it with the following C# Code:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
 {
  // CTRL_A Select All not handled by default
  if (Convert.ToInt(e.KeyChar) == 1) textBox1.SelectAll();
 }
Rating 3.00 out of 5

6/23/2010

Saw this as the email signature from a joeware fan…

by @ 3:26 pm. Filed under humour

“If you want to know what type a certain bear is, sneak up behind it and kick it. Then,
run like crazy and climb up a tree. If the bear climbs the tree and eats you, it’s a black
bear. If the bear just pushes the tree over and eats you, it’s a grizzly bear.”

Rating 4.33 out of 5

IT Lesson of the day…

by @ 2:53 pm. Filed under tech

If you are running Internet Explorer 6 SP1, it is probably a good time to upgrade. 🙂

Rating 3.00 out of 5

In the mailbag… Palindrome

by @ 2:31 pm. Filed under general

Pretty interesting.

 

 

Lost Generation

Rating 4.00 out of 5

Cool website

by @ 10:55 am. Filed under tech

http://portableapps.com

Rating 3.50 out of 5

6/19/2010

So what service is registering my dynamic DNS updates? (non-Domain Controller SRV records)

by @ 1:51 am. Filed under tech

I’m sure you have had that question before or seen it before. It is a popular question. And of course as everyone knows or at least finds out (possibly after much painful troubleshooting) is that it is the DHCP Client Service that registers your dynamic DNS updates. And when you learn that you say, but my servers aren’t using DHCP so that can’t be right… Doesn’t matter, the DHCP Client is registering the names in DNS for you… So don’t shut it off unless you don’t want your servers magically registering themselves… 

That is what we have been learning and possibly relearning and recalling every time that question has been asked since Windows 2000 first went RTM. You may have forgotten it after you first heard it in class or from a casual conversation or saw it on an internet post but the first time you can’t resolve a server to name and track it down to the fact that someone disabled the DHCP Client Service because “the server wasn’t and wouldn’t ever use DHCP” you will not forget again. Right?

Well get ready to forget that piece of trivia. Microsoft was sneaky and changed the DNS Registration functionality from the DHCP Client Service to the DNS Client Service… WHOA! This change from what I understand started in Windows Vista. I don’t do much with client OSes so never ran into it. But I can absolutely confirm that this functionality is in Windows Server 2008. I glanced through the Source Code for Windows Server 2008 for the dynamic updates and performed about 30 minutes of testing with WireShark and it absolutely is moved into the DNS Client Service.

Now I admit, I may be a little behind the curve and some of you are almost certainly going to say, whoa joe… you ARE behind the curve… But I felt I would share this info because I just learned it and when I looked around I saw some confusing internet posts on the topic. 

One MSFT document I saw said that sometimes the DNS Client Service does the registration, sometimes the DHCP Client Service does the registration. When I looked at the source code, that didn’t seem to be the case, also my testing didn’t seem to bear that out. Even if I was using DHCP for the server, if I disabled the DNS Client Service and, obviously, had the DHCP Client running fine, it wasn’t registering its name at all. IPCONFIG/REGISTERDNS absolutely used the DNS Client Service as well.

I updated the Wikipedia article on Microsoft DNS to reflect this change in functionality.

 

    joe

Rating 4.63 out of 5

6/17/2010

The daily rant… Part Deux

by @ 11:36 am. Filed under rants

+ cscript isn’t defined as the default scripting engine

+ it requires an admin to change the default scripting engine because it can’t be set at the user context level

 

Why aren’t servers cscript by default??? This is a quick and easy change when building servers… Either

1. Run cscript //h:cscript

or

2. Change the value default value of HKCR\vbsfile\shell to “Open2”

Rating 3.00 out of 5

The daily rant…

by @ 11:14 am. Filed under rants

It irks me when companies I need to help out don’t have my tools loaded on their servers…

+ they lock down internet so I can’t get them…

+ DSQUERY/GET doesn’t retrieve RootDSE and generally suck next to my utilities…

+ REPADMIN isn’t loaded either…

 

Here I am trying to write vbscripts to duplicate functionality I wrote into my tools years ago… And of course not all functionality can be duplicated.

Rating 3.00 out of 5

6/10/2010

Bad Google…

by @ 1:07 pm. Filed under general

Taking my simple white background away… even temporarily isn’t nice… I don’t appear to be alone in that thought.

We like Google on White!

From what I understand, it will be back to normal shortly.

joe

Rating 3.00 out of 5

[joeware – never stop exploring… :) is proudly powered by WordPress.]