Page 1 of 1 1
Topic Options
#41629 - 2003-06-17 03:52 PM Get Ip doesnt work in windows nt 4.0
Deniz Offline
Fresh Scripter

Registered: 2003-06-11
Posts: 11
Loc: Brazil
Hello everyone.

I made up this script, and it is working fine with Windows 98, 2000 and XP, but it seems not work in windows nt 4.0.

I get this error message: select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE
6The handle is invalid.

The script is following:

===================================
$survey = 01
$memoria = memorysize() + 1

$IpSet = GetObject("winmgmts:").ExecQuery("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

If @error <> 0
? @error + " / " @serror
else
For Each $IPConfig In $IPSet
$IP = $IPConfig.IPAddress(0)
IF Open( 3 , "\\spohs01\viruslog\controle.txt" , 5 ) = 0
$x = WriteLine(3 , "IP" + "," + $survey + "," + @WKSTA + "," + @LDOMAIN + "," + @USERID + "," + @MDAYNO + "," + @MONTHNO + "," + @YEAR + "," + $IP + "," + Chr(13) + Chr(10))
endif

Next
EndIf

exit 1
====================================
Does anyone have a clue? Its the same login script for all users, but it really doesnt work for windows nt 4.0

Thank you alll
Best Regards

Deniz Feital
_________________________
Deniz Feital

Top
#41630 - 2003-06-17 03:53 PM Re: Get Ip doesnt work in windows nt 4.0
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Is WMI installed?
_________________________
There are two types of vessels, submarines and targets.

Top
#41631 - 2003-06-17 03:56 PM Re: Get Ip doesnt work in windows nt 4.0
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
look at WMIQuery()... it does most of the work for you.

However, Jens is probably right. WMI isn't built into NT4, but only as an option in SP 3 or 4
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#41632 - 2003-06-17 03:57 PM Re: Get Ip doesnt work in windows nt 4.0
Deniz Offline
Fresh Scripter

Registered: 2003-06-11
Posts: 11
Loc: Brazil
I am sorry, this message was sent to me? I didnt understand it.

Thanks !
_________________________
Deniz Feital

Top
#41633 - 2003-06-17 04:03 PM Re: Get Ip doesnt work in windows nt 4.0
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
You need to install WMI Core file to be able to get your script running on NT !

[Eek!] The FAQ link for WMI Core files for NT is no longer valid and all I was able to find is the WMI Core dist. for 9x [Eek!]

[Mad]

[ 17. June 2003, 16:05: Message edited by: Jochen ]
_________________________



Top
#41634 - 2003-06-17 04:32 PM Re: Get Ip doesnt work in windows nt 4.0
Deniz Offline
Fresh Scripter

Registered: 2003-06-11
Posts: 11
Loc: Brazil
Well, cant I run my script to get an IP address from my windows nt 4.0? Is that correct?

I thought I could because it works really fine over other OS.

Regards.
_________________________
Deniz Feital

Top
#41635 - 2003-06-17 04:39 PM Re: Get Ip doesnt work in windows nt 4.0
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
As stated before, your code requires WMI installed on your NT 4.0 computers. Thus, is WMI installed?

You can also get the IP addresses with the @IPADDRESSx macro, see the KiXtart Manual for details.
_________________________
There are two types of vessels, submarines and targets.

Top
#41636 - 2003-06-17 04:45 PM Re: Get Ip doesnt work in windows nt 4.0
Deniz Offline
Fresh Scripter

Registered: 2003-06-11
Posts: 11
Loc: Brazil
Hi Jen.

The macro @IPADDRESSx will fit perfectly.

Thank you for your patience.

Best Regards,
_________________________
Deniz Feital

Top
#41637 - 2003-06-17 04:54 PM Re: Get Ip doesnt work in windows nt 4.0
Deniz Offline
Fresh Scripter

Registered: 2003-06-11
Posts: 11
Loc: Brazil
Well, still not working with Windows NT 4.0.

I am not sure if wmi is installed in our workstations, but I bet its not. I know quite nothing about Kix, just trying to make an inventory at the company where I work. I need is to find a couple of values in each workstation, values like, computername, username, operational system and ip address. All is working fine but Ip address. I need to know the ip address to find out where the workstation is. I've tried, @ipaddress, GetObject("winmgmts:") and so on, but nothing seems to work in nt 4.0. I am thinking to use the command ipconfig >test.txt and try to extract the line IP address on that file. Do you know kix can do it?

Thank you again.
_________________________
Deniz Feital

Top
#41638 - 2003-06-17 04:57 PM Re: Get Ip doesnt work in windows nt 4.0
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The @IPAddressX macro has the mandatory X parameter.

Borrowing from the manual...
quote:
TCP/IP address (possible values for x are 0 - 3). Addresses are padded so that the resulting string always consists of four sets of three characters separated by periods (a total of 15 characters). For example, if your IP address is 123.45.6.7, @IPADDRESS0 is "123. 45. 6. 7".
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#41639 - 2003-06-17 04:59 PM Re: Get Ip doesnt work in windows nt 4.0
Deniz Offline
Fresh Scripter

Registered: 2003-06-11
Posts: 11
Loc: Brazil
I tried to use it.

It works really fine in Windows 98, Windows 2000 and Windows XP, but doesnt work in Windows NT 4.0 and I still have some windows nt 4.0 workstation at my company.

Thats the issue, I am not being able to find out the ip address for those windows nt 4.0.

Thanks
_________________________
Deniz Feital

Top
#41640 - 2003-06-17 05:01 PM Re: Get Ip doesnt work in windows nt 4.0
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
What version of KiX? try it with the 4.21 version.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#41641 - 2003-06-17 05:03 PM Re: Get Ip doesnt work in windows nt 4.0
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
So, you're saying that
code:
? 'IP Address = '+@IPADDRESS0
? 'Error '+@ERROR+' - '+@SERROR

does not work for you?

This will only not work if there's no IP address at all on that computer. You might want to reread the KiXtart Manual and fix your KiXtart install, it seems to be messed up.
_________________________
There are two types of vessels, submarines and targets.

Top
#41642 - 2003-06-17 05:19 PM Re: Get Ip doesnt work in windows nt 4.0
Deniz Offline
Fresh Scripter

Registered: 2003-06-11
Posts: 11
Loc: Brazil
Yes, I am using the versio 4.21.
_________________________
Deniz Feital

Top
#41643 - 2003-06-17 05:54 PM Re: Get Ip doesnt work in windows nt 4.0
Deniz Offline
Fresh Scripter

Registered: 2003-06-11
Posts: 11
Loc: Brazil
Oh Gosh, thank you everyone. Its working.

[Smile]

You are really cool !
_________________________
Deniz Feital

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.255 seconds in which 0.226 seconds were spent on a total of 12 queries. Zlib compression enabled.

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