Page 2 of 2 <12
Topic Options
#154869 - 2006-01-11 03:27 AM Re: @Address
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11571
Loc: CA
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
 

Top
#154870 - 2006-01-11 03:27 AM Re: @Address
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
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?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#154871 - 2006-01-11 03:51 AM Re: @Address
tylan Offline
Starting to like KiXtart

Registered: 2005-11-17
Posts: 115
Loc: Johnstown, PA
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.

Top
#154872 - 2006-01-11 05:58 AM Re: @Address
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11571
Loc: CA
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.
 

Top
#154873 - 2006-01-11 07:16 AM Re: @Address
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
ja, if your PC's are those considered Clones (in PC world, the word doesn't really suite anymore), there is no SN available.
_________________________
!

download KiXnet

Top
#154874 - 2006-01-11 12:14 PM Re: @Address
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
true... many older and many 'non-manageable' and the frankensteins will not have that info.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#154875 - 2006-01-11 12:52 PM Re: @Address
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
in newer systems you can check the CPUID though...
_________________________
!

download KiXnet

Top
#154876 - 2006-01-11 01:05 PM Re: @Address
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
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 $

_________________________
!

download KiXnet

Top
#154877 - 2006-01-11 02:55 PM Re: @Address
tylan Offline
Starting to like KiXtart

Registered: 2005-11-17
Posts: 115
Loc: Johnstown, PA
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.

Top
#154878 - 2006-01-16 04:29 PM Re: @Address
tylan Offline
Starting to like KiXtart

Registered: 2005-11-17
Posts: 115
Loc: Johnstown, PA
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!

Top
#154879 - 2006-01-16 05:33 PM Re: @Address
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
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.
_________________________
!

download KiXnet

Top
#154880 - 2006-01-16 06:08 PM Re: @Address
tylan Offline
Starting to like KiXtart

Registered: 2005-11-17
Posts: 115
Loc: Johnstown, PA
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?

Top
#154881 - 2006-01-16 08:53 PM Re: @Address
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
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.
_________________________
!

download KiXnet

Top
#154882 - 2006-01-16 08:55 PM Re: @Address
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
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.
_________________________
!

download KiXnet

Top
#154883 - 2006-01-16 10:00 PM Re: @Address
tylan Offline
Starting to like KiXtart

Registered: 2005-11-17
Posts: 115
Loc: Johnstown, PA
That makes sense. Simple is better.

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

Top
#154884 - 2006-01-16 10:06 PM Re: @Address
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#154885 - 2006-01-17 04:16 AM Re: @Address
tylan Offline
Starting to like KiXtart

Registered: 2005-11-17
Posts: 115
Loc: Johnstown, PA
Can I dare ask how?

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

Top
#154886 - 2006-01-17 07:22 AM Re: @Address
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11571
Loc: CA
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







Top
#154887 - 2006-01-17 09:11 AM Re: @Address
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22335
Loc: OK
and, if you place empty string on the value name, the whole section will be removed.
_________________________
!

download KiXnet

Top
#154888 - 2006-01-17 04:51 PM Re: @Address
tylan Offline
Starting to like KiXtart

Registered: 2005-11-17
Posts: 115
Loc: Johnstown, PA
I feel stupid. Thanks for your patience guys!
Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 60 anonymous users online.
Newest Members
diefnet, Arogya, gkustra, emnipetro, Hirze
17644 Registered Users

Generated in 0.04 seconds in which 0.01 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org