PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > Re: Script that shows prmary DNS
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: Script that shows prmary DNS

Réponse
 
LinkBack Outils de la discussion
Vieux 16/11/2007, 03h51   #1
Kai.Bluesky
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Script that shows prmary DNS

Dear,

http://www.microsoft.com/technet/scr.../nwlsvb02.mspx
Hope it may .

Best Regards,
Kai

On Nov 16, 9:01 am, skip <s...@discussions.microsoft.com> wrote:
> Hello all
>
> I need to list the primary DNS ip address for all my servers. All servers
> are in an OU, is there a vb script available that i can run that will show
> the primary
> DNS settings for the network adapter?
>
> Thanks


  Réponse avec citation
Vieux 16/11/2007, 08h07   #2
Kai.Bluesky
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Script that shows prmary DNS

Dear,

You can easy find many examples of CreateTextFile Method,
and then replace the sample code Wscript.echo with WriteLine.
http://msdn2.microsoft.com/en-us/library/5t9b5c0c.aspx

Hope it may .

Best Regards,
Kai

On Nov 16, 11:26 am, skip <s...@discussions.microsoft.com> wrote:
> very cool, can you tell me how i can export the results to a txt file?
>
> thanks again
>
> "Kai.Bluesky" wrote:
> > Dear,

>
> >http://www.microsoft.com/technet/scr...etwork/client/...
> > Hope it may .

>
> > Best Regards,
> > Kai

>
> > On Nov 16, 9:01 am, skip <s...@discussions.microsoft.com> wrote:
> > > Hello all

>
> > > I need to list the primary DNS ip address for all my servers. All servers
> > > are in an OU, is there a vb script available that i can run that will show
> > > the primary
> > > DNS settings for the network adapter?

>
> > > Thanks

  Réponse avec citation
Vieux 16/11/2007, 16h06   #3
skip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Script that shows prmary DNS

That will work just fine
Thanks again!

"Kai.Bluesky" wrote:

> Dear,
>
> You can easy find many examples of CreateTextFile Method,
> and then replace the sample code Wscript.echo with WriteLine.
> http://msdn2.microsoft.com/en-us/library/5t9b5c0c.aspx
>
> Hope it may .
>
> Best Regards,
> Kai
>
> On Nov 16, 11:26 am, skip <s...@discussions.microsoft.com> wrote:
> > very cool, can you tell me how i can export the results to a txt file?
> >
> > thanks again
> >
> > "Kai.Bluesky" wrote:
> > > Dear,

> >
> > >http://www.microsoft.com/technet/scr...etwork/client/...
> > > Hope it may .

> >
> > > Best Regards,
> > > Kai

> >
> > > On Nov 16, 9:01 am, skip <s...@discussions.microsoft.com> wrote:
> > > > Hello all

> >
> > > > I need to list the primary DNS ip address for all my servers. All servers
> > > > are in an OU, is there a vb script available that i can run that will show
> > > > the primary
> > > > DNS settings for the network adapter?

> >
> > > > Thanks

>

  Réponse avec citation
Vieux 16/11/2007, 21h51   #4
skip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Script that shows prmary DNS

Ok i modifed the script so i am able to export the info to a .txt file, but
the script only gathers the info from the local machine not any remote
machines, so what i was thinking of doing was creae a user gpo and link it to
the servers OU, when a user log's onto the server the script will run. What i
need now is modify the script so it dumps the script on a network share and
names itself with the name of the server from wich it ran on. Below is a
copy of the script that i am using

thanks very much

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

n = 1
WScript.Echo

For Each objAdapter in colAdapters
WScript.Echo "Network Adapter " & n
WScript.Echo "================="
WScript.Echo " Description: " & objAdapter.Description

WScript.Echo " Physical (MAC) address: " & objAdapter.MACAddress
WScript.Echo " Host name: " & objAdapter.DNSHostName

If Not IsNull(objAdapter.IPAddress) Then
For i = 0 To UBound(objAdapter.IPAddress)
WScript.Echo " IP address: " & objAdapter.IPAddress(i)
Next
End If

If Not IsNull(objAdapter.IPSubnet) Then
For i = 0 To UBound(objAdapter.IPSubnet)
WScript.Echo " Subnet: " & objAdapter.IPSubnet(i)
Next
End If

If Not IsNull(objAdapter.DefaultIPGateway) Then
For i = 0 To UBound(objAdapter.DefaultIPGateway)
WScript.Echo " Default gateway: " & _
objAdapter.DefaultIPGateway(i)
Next
End If

WScript.Echo
WScript.Echo " DNS"
WScript.Echo " ---"
WScript.Echo " DNS servers in search order:"

If Not IsNull(objAdapter.DNSServerSearchOrder) Then
For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
WScript.Echo " " & objAdapter.DNSServerSearchOrder(i)
Next
End If

WScript.Echo " DNS domain: " & objAdapter.DNSDomain

If Not IsNull(objAdapter.DNSDomainSuffixSearchOrder) Then
For i = 0 To UBound(objAdapter.DNSDomainSuffixSearchOrder)
WScript.Echo " DNS suffix search list: " & _
objAdapter.DNSDomainSuffixSearchOrder(i)
Next
End If

WScript.Echo
WScript.Echo " DHCP"
WScript.Echo " ----"
WScript.Echo " DHCP enabled: " & objAdapter.DHCPEnabled
WScript.Echo " DHCP server: " & objAdapter.DHCPServer

If Not IsNull(objAdapter.DHCPLeaseObtained) Then
utcLeaseObtained = objAdapter.DHCPLeaseObtained
strLeaseObtained = WMIDateStringToDate(utcLeaseObtained)
Else
strLeaseObtained = ""
End If
WScript.Echo " DHCP lease obtained: " & strLeaseObtained

If Not IsNull(objAdapter.DHCPLeaseExpires) Then
utcLeaseExpires = objAdapter.DHCPLeaseExpires
strLeaseExpires = WMIDateStringToDate(utcLeaseExpires)
Else
strLeaseExpires = ""
End If
WScript.Echo " DHCP lease expires: " & strLeaseExpires

WScript.Echo
WScript.Echo " WINS"
WScript.Echo " ----"
WScript.Echo " Primary WINS server: " & objAdapter.WINSPrimaryServer
WScript.Echo " Secondary WINS server: " & objAdapter.WINSSecondaryServer
WScript.Echo

n = n + 1

Next

Function WMIDateStringToDate(utcDate)
WMIDateStringToDate = CDate(Mid(utcDate, 5, 2) & "/" & _
Mid(utcDate, 7, 2) & "/" & _
Left(utcDate, 4) & " " & _
Mid (utcDate, 9, 2) & ":" & _
Mid(utcDate, 11, 2) & ":" & _
Mid(utcDate, 13, 2))
End Function


"Kai.Bluesky" wrote:

> Dear,
>
> You can easy find many examples of CreateTextFile Method,
> and then replace the sample code Wscript.echo with WriteLine.
> http://msdn2.microsoft.com/en-us/library/5t9b5c0c.aspx
>
> Hope it may .
>
> Best Regards,
> Kai
>
> On Nov 16, 11:26 am, skip <s...@discussions.microsoft.com> wrote:
> > very cool, can you tell me how i can export the results to a txt file?
> >
> > thanks again
> >
> > "Kai.Bluesky" wrote:
> > > Dear,

> >
> > >http://www.microsoft.com/technet/scr...etwork/client/...
> > > Hope it may .

> >
> > > Best Regards,
> > > Kai

> >
> > > On Nov 16, 9:01 am, skip <s...@discussions.microsoft.com> wrote:
> > > > Hello all

> >
> > > > I need to list the primary DNS ip address for all my servers. All servers
> > > > are in an OU, is there a vb script available that i can run that will show
> > > > the primary
> > > > DNS settings for the network adapter?

> >
> > > > Thanks

>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h55.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,26108 seconds with 12 queries