tylan
(Starting to like KiXtart)
2006-01-09 04:39 PM
@Address

Anyone ever see the @address macro return a blank mac address? I've updated the driver of the offending machine, and probably going to switch out the card. Is this a bug with Kix or just flaky machine? I'm running kix 451 and the machine is 2000 pro sp4.

NTDOCAdministrator
(KiX Master)
2006-01-09 04:48 PM
Re: @Address

Yes, it can easily happen on a multi-nic system.

Try running the @IPADDRESS0 and @IPADDRESS1, @IPADDRESS2, @IPADDRESS3

and see what you get on that system.

Unfortunately I've not seen any good code to sort out the ACTIVE nic card natively.

You could try some PING and NSLOOKUP calls but that can be a pain too because if anything is off on WINS/DNS then the system may not ping it'self. You could shell and do IPCONFIG and grab it that way, but that too is a pain.


tylan
(Starting to like KiXtart)
2006-01-09 04:52 PM
Re: @Address

This is a single NIC computer. I uninstalled the intel pro 100, and put in a 3com and all is good now.

NTDOCAdministrator
(KiX Master)
2006-01-09 07:18 PM
Re: @Address

Okay, yeah. Probably a software issue on that system. Typically only see a blank IP on laptops that logon with a different nic.

tylan
(Starting to like KiXtart)
2006-01-09 07:22 PM
Re: @Address

My question was about blank MACs. But, It still seems to be PC specific.

NTDOCAdministrator
(KiX Master)
2006-01-09 07:25 PM
Re: @Address



Sorry about that. Just noticed that.

Well there actually have been issues with a few vendors where there software was wrong and created duplicate MAC addresses on the network.

But don't recall seeing anything about BLANK MAC so guess you were just the lucky one to start the New Year out with a new issue

Seems you got it worked out though.


Les
(KiX Master)
2006-01-09 07:31 PM
Re: @Address

Poke around your system a bit. Could be that there is firewire or some virtual NIC that is stealing top place.

tylan
(Starting to like KiXtart)
2006-01-09 07:47 PM
Re: @Address

I'm using the MAC as the section of an INI file that contains all the computers that have a specific application installed. I figured using the MAC would prevent duplicate entries if I rename a computer. Do you think that's an acceptable way of cataloging PCs?

Radimus
(KiX Supporter)
2006-01-09 07:57 PM
Re: @Address

MAC or Serial number

tylan
(Starting to like KiXtart)
2006-01-09 08:13 PM
Re: @Address

What serial number would that be?

Radimus
(KiX Supporter)
2006-01-09 08:17 PM
Re: @Address

pc serial number

tylan
(Starting to like KiXtart)
2006-01-09 08:44 PM
Re: @Address

gonna have to do some digging on that one. Would that be the SN of your windows product?

Radimus
(KiX Supporter)
2006-01-09 08:50 PM
Re: @Address

SN of the computer itself... from BIOS...

research WMIQuery()


Les
(KiX Master)
2006-01-09 10:03 PM
Re: @Address

Could probably pull the MAC with WMI too.

AllenAdministrator
(KiX Supporter)
2006-01-09 10:17 PM
Re: @Address

Quote:

Could probably pull the MAC with WMI too.




As a matter of fact you can, and if you might test it with RFC - GetIPOptions(), I think it will provide you with what you looking for. Just use:

Code:
 ? "        Mac Address:  " + getipoptions("Macaddress") 



Radimus
(KiX Supporter)
2006-01-09 10:24 PM
Re: @Address

for each $mac in WMIQuery("MACAddress","Win32_NetworkAdapter")
? $mac
next


$serno = WMIQuery("SerialNumber","Win32_BIOS")[0]


Les
(KiX Master)
2006-01-09 10:29 PM
Re: @Address

Quote:

As a matter of fact you can...



I only covered my ass because the KiX macro wasn't doing it for him. I realize that normally you can.


AllenAdministrator
(KiX Supporter)
2006-01-09 10:36 PM
Re: @Address

While I quoted you Les, I really was responding to Tylan... but all the same I glad you finally covered your arse... the impression of your crack, on your co-workers brains, will not be soon forgotten.

tylan
(Starting to like KiXtart)
2006-01-10 04:31 PM
Re: @Address

I guess I'm going to stick with the @Address macro, and watch my log file grow. If I continue to see [] for section names that are supposed to be MAC Addresses I will look into changing my code. I think I just hit a oddball machine, and the @Address macro will be successfull most of the time.

tylan
(Starting to like KiXtart)
2006-01-11 02:51 AM
Re: @Address

I tried the WMIQuery.

$serno = WMIQuery("SerialNumber","Win32_BIOS")[0]

Any idea on why the output was sys-1234567890? On two other PCs, I had a blank as my output. Am I missing something, or is this not going to be a viable way of tracking computers?


NTDOCAdministrator
(KiX Master)
2006-01-11 03:27 AM
Re: @Address

Might want to try this UDF in conjunction with your WMI Query.

ConfirmWMI() - Confirm access and version of WMI
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=114011&an=0&page=2#114011
 


Radimus
(KiX Supporter)
2006-01-11 03:27 AM
Re: @Address

one of the peculiarities of WMI is that it sometimes wants the user to local admin.

the PC needs to be WinNT sp4 or better

additionally, do you have the UDF in the script?


tylan
(Starting to like KiXtart)
2006-01-11 03:51 AM
Re: @Address

I was the local admin on all three tests, and I do have the UDF in the script.

I'm using Radimus' WMIQuery 2.5.

The WMICheck gave me 5.1.2600.2180 on an XP Pro SP2. This was the system that gave me SYS-1234567890 as the SN. It also gave 5.2.3790.1830 for a 2003 Server SP1. That server gave me a blank for the SN. The other machine that gave me a blank reported 1.50.1085.63 as the WMI version. It's a Win2000 SP4.


NTDOCAdministrator
(KiX Master)
2006-01-11 05:58 AM
Re: @Address

Okay, I thought the number looked odd. That is a generic number that someone just plugged in.

There is another call in WMI that you can use to make a different call to see if that will return a serial number or not, but some mfg just don't supply a serial number in the BIOS.
 


LonkeroAdministrator
(KiX Master Guru)
2006-01-11 07:16 AM
Re: @Address

ja, if your PC's are those considered Clones (in PC world, the word doesn't really suite anymore), there is no SN available.

Radimus
(KiX Supporter)
2006-01-11 12:14 PM
Re: @Address

true... many older and many 'non-manageable' and the frankensteins will not have that info.

LonkeroAdministrator
(KiX Master Guru)
2006-01-11 12:52 PM
Re: @Address

in newer systems you can check the CPUID though...

LonkeroAdministrator
(KiX Master Guru)
2006-01-11 01:05 PM
Re: @Address

Code:

Break On
$strComputer = "."
$objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select ProcessorID from Win32_Processor",,48)
For each $objItem in $colItems
$objItem.ProcessorId ?
Next
? 'Press Any Key to close the window'
get $



tylan
(Starting to like KiXtart)
2006-01-11 02:55 PM
Re: @Address

What if I go back to my original code, but add in some redundancy checks?
Code:
 
$pgmaster="\\somerset-dc\ParInstall\Paragon61\pgmasterlist.ini"

$rc=writeprofilestring($pgmaster,'@WKSTA','Username','@USERID')
$rc=writeprofilestring($pgmaster,'@WKSTA','IPAddress','@IPADDRESS0')
$rc=writeprofilestring($pgmaster,'@WKSTA','MAC','@ADDRESS')
$rc=writeprofilestring($pgmaster,'@WKSTA','Paragon61','Yes')

IF EXIST ("C:\PROGRAM FILES\PARAGON61\pgFormUtility.exe")
$rc=writeprofilestring($pgmaster,'@WKSTA','Forms','Yes')
ELSE
$rc=writeprofilestring($pgmaster,'@WKSTA','Forms','No')
ENDIF



What could I add to make each computer check the existing entries before adding a new computer name. Maybe an IF statement that checks to see if the computer name exists, and then to look for the mac address, then add itself as new after the mac wasn't found. I really like this simple code but it doesn't allow for computer name changes. If I make MAC Addresses the [section] it will make a double entry if a computer logs in wired then wireless.


tylan
(Starting to like KiXtart)
2006-01-16 04:29 PM
Re: @Address

Is my previous post possible? Can you build a simple "database" that checks the MAC and the computer name? I am at a loss and would really appreciate a little more insight on this.

Thanks in advance!


LonkeroAdministrator
(KiX Master Guru)
2006-01-16 05:33 PM
Re: @Address

databases don't check nothing, they store info.
if you want some insight, it would really help if you specify clearly what you are after.

anyway, as you seem to want a per computer section, use CPUID.
you can get it with WMI from win32_processor and it is always per machine.


tylan
(Starting to like KiXtart)
2006-01-16 06:08 PM
Re: @Address

I'm sorry. The "database" was referring to my last post. I meant can I build some redundancy checks into the INI file I was starting with. I wrapped database in quotes because I know that an INI file surely isn't a database.

So, rather than trying to do multiple checks on the info you are suggesting to go with CPU ID. I remember something with being able to turn off the CPU ID in the bios. That could cause some issues, correct?


LonkeroAdministrator
(KiX Master Guru)
2006-01-16 08:53 PM
Re: @Address

well, you can try and search for such system but I say it's currently the best way to detect a system.

and yes, ini file can be called a database.
what my comment ment that you can't code the checking in the ini but the logic, if you need to build one has nothing to do with it.


LonkeroAdministrator
(KiX Master Guru)
2006-01-16 08:55 PM
Re: @Address

and, yes.
you can go searching the whole ini file for dublicates, but then.
what would you do if you find a matching system name with different MAC?
or matching MAC with different system name?

too much checking just makes it complicated.
I would say you are best of with blind writes and have a different script do the collection stuff.
that script could even do a report including the changed ID tags and so on.


tylan
(Starting to like KiXtart)
2006-01-16 10:00 PM
Re: @Address

That makes sense. Simple is better.

Does kix even have the ability to delete entries or entire sections from an INI file?


Les
(KiX Master)
2006-01-16 10:06 PM
Re: @Address

Yes.

tylan
(Starting to like KiXtart)
2006-01-17 04:16 AM
Re: @Address

Can I dare ask how?

I went through the UDFs, but I didn't see anything relevant. Maybe I wasn't looking hard enough.


NTDOCAdministrator
(KiX Master)
2006-01-17 07:22 AM
Re: @Address

In the manual

Quote:


WriteProfileString( )
 
Action: Copies a string to an initialization file.
 
Syntax: WriteProfileString ("file name", "section", "key", "string")
 
Parameters: File name
String identifying the initialization file.
 
Section
 
String containing the name of the section of the initialization file where string is copied. If the section does not exist, it is created. The section name is not case-sensitive, and can contain any combination of uppercase and lowercase letters.
 
Key
 
String containing the name of the key to associate with string. If the key does not exist in the specified section, it is created. If this parameter is empty, the entire section, including all entries within the section, is deleted.
 
String
 
String to write to the file. If this parameter is empty, the key identified by key is deleted.
 
Note: On Windows 9x, use of the tab character (\t) is not supported as part of this parameter

Remarks: This function is provided for compatibility with 16-bit Windows-based applications. Win32-based applications store initialization information in the registry.
 
Returns: 0 Profile string written
Error code Function failed

 
See Also: ReadProfileString( ), ReadLine( ), WriteLine( )

Example: $IniFile=substr('%WINDIR%',1,2)+'\SMS.INI'
if exist($IniFile)
$rc=writeprofilestring($IniFile,'Sight','Allow Takeover','Yes')
$rc=writeprofilestring($IniFile,'Sight','Allow Reboot','Yes')
$rc=writeprofilestring($IniFile,'Sight','Allow File Transfer','Yes')
$rc=writeprofilestring($IniFile,'Sight','Allow Chat','Yes')
$rc=writeprofilestring($IniFile,'Sight','Allow Remote Execute','Yes')
endif








LonkeroAdministrator
(KiX Master Guru)
2006-01-17 09:11 AM
Re: @Address

and, if you place empty string on the value name, the whole section will be removed.

tylan
(Starting to like KiXtart)
2006-01-17 04:51 PM
Re: @Address

I feel stupid. Thanks for your patience guys!