Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
scripts
hosting
jscript
remote
scripting.wsh
scriptlets
vbscript
virus.discussion
  
 
date: Fri, 5 Aug 2005 10:42:52 -0400,    group: microsoft.public.scripting.vbscript        back       


IPconfig script   
I use VNC and have to walk users through cmd > ipconfig to get there IP 
address. Is there a batch file I could place on their desktops to simply 
click and display the address.

Thanks.
date: Fri, 5 Aug 2005 10:42:52 -0400   author:   Bobby

RE: IPconfig script   
Sure,
Just paste this into a text file and name it something.vbs.

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

Set IPConfigSet = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
 
For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then 
        For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
            WScript.Echo IPConfig.IPAddress(i)
        Next
    End If
Next



"Bobby" wrote:

> I use VNC and have to walk users through cmd > ipconfig to get there IP 
> address. Is there a batch file I could place on their desktops to simply 
> click and display the address.
> 
> Thanks. 
> 
> 
>
date: Fri, 5 Aug 2005 08:00:19 -0700   author:   bxr222

Re: IPconfig script   
That's nice. Thanks. (Wish I knew scripting)


"bxr222"  wrote in message 
news:A2184B59-7D3D-4F74-9B56-30ED98B68F13@microsoft.com...
> Sure,
> Just paste this into a text file and name it something.vbs.
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
>    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
>
> Set IPConfigSet = objWMIService.ExecQuery _
>    ("Select * from Win32_NetworkAdapterConfiguration Where 
> IPEnabled=TRUE")
>
> For Each IPConfig in IPConfigSet
>    If Not IsNull(IPConfig.IPAddress) Then
>        For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
>            WScript.Echo IPConfig.IPAddress(i)
>        Next
>    End If
> Next
>
>
>
> "Bobby" wrote:
>
>> I use VNC and have to walk users through cmd > ipconfig to get there IP
>> address. Is there a batch file I could place on their desktops to simply
>> click and display the address.
>>
>> Thanks.
>>
>>
>>
date: Fri, 5 Aug 2005 11:25:19 -0400   author:   Bobby

Re: IPconfig script   
Here's a variation that may be even easier...

create a shortcut on desktop with the target:

cmd /k  ipconfig



Get creative and create a login script that will create this shortcut on
each user's desktop, something like this:

dim winshell
dim shortcut
dim winnet

set winnet = createobject("Wscript.Network")
set winshell = createobject("Wscript.Shell")
set shortcut = winshell.createshortcut("C:\documents and settings\" &
winnet.username & "\desktop\name of shortcut.lnk")

shortcut.targetpath = "cmd /k ipconfig"
shortcut.save

wscript.quit


"Bobby"  wrote in message
news:uynAlHdmFHA.3120@TK2MSFTNGP09.phx.gbl...
> That's nice. Thanks. (Wish I knew scripting)
>
>
> "bxr222"  wrote in message
> news:A2184B59-7D3D-4F74-9B56-30ED98B68F13@microsoft.com...
> > Sure,
> > Just paste this into a text file and name it something.vbs.
> >
> > strComputer = "."
> > Set objWMIService = GetObject("winmgmts:" _
> >    & "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
> >
> > Set IPConfigSet = objWMIService.ExecQuery _
> >    ("Select * from Win32_NetworkAdapterConfiguration Where
> > IPEnabled=TRUE")
> >
> > For Each IPConfig in IPConfigSet
> >    If Not IsNull(IPConfig.IPAddress) Then
> >        For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
> >            WScript.Echo IPConfig.IPAddress(i)
> >        Next
> >    End If
> > Next
> >
> >
> >
> > "Bobby" wrote:
> >
> >> I use VNC and have to walk users through cmd > ipconfig to get there IP
> >> address. Is there a batch file I could place on their desktops to
simply
> >> click and display the address.
> >>
> >> Thanks.
> >>
> >>
> >>
>
>
date: Fri, 5 Aug 2005 15:30:41 -0700   author:   Steve Wolfie am

Re: IPconfig script   
Hello,
This is really cooolll...
Can ANYONE suggest some books on VBScript???


"Steve Wolfie" <stevewolfie@community.nospam> wrote in message
news:uxxSEygmFHA.3336@tk2msftngp13.phx.gbl...
> Here's a variation that may be even easier...
>
> create a shortcut on desktop with the target:
>
> cmd /k  ipconfig
>
>
>
> Get creative and create a login script that will create this shortcut on
> each user's desktop, something like this:
>
> dim winshell
> dim shortcut
> dim winnet
>
> set winnet = createobject("Wscript.Network")
> set winshell = createobject("Wscript.Shell")
> set shortcut = winshell.createshortcut("C:\documents and settings\" &
> winnet.username & "\desktop\name of shortcut.lnk")
>
> shortcut.targetpath = "cmd /k ipconfig"
> shortcut.save
>
> wscript.quit
>
>
> "Bobby"  wrote in message
> news:uynAlHdmFHA.3120@TK2MSFTNGP09.phx.gbl...
> > That's nice. Thanks. (Wish I knew scripting)
> >
> >
> > "bxr222"  wrote in message
> > news:A2184B59-7D3D-4F74-9B56-30ED98B68F13@microsoft.com...
> > > Sure,
> > > Just paste this into a text file and name it something.vbs.
> > >
> > > strComputer = "."
> > > Set objWMIService = GetObject("winmgmts:" _
> > >    & "{impersonationLevel=impersonate}!\\" & strComputer &
> "\root\cimv2")
> > >
> > > Set IPConfigSet = objWMIService.ExecQuery _
> > >    ("Select * from Win32_NetworkAdapterConfiguration Where
> > > IPEnabled=TRUE")
> > >
> > > For Each IPConfig in IPConfigSet
> > >    If Not IsNull(IPConfig.IPAddress) Then
> > >        For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
> > >            WScript.Echo IPConfig.IPAddress(i)
> > >        Next
> > >    End If
> > > Next
> > >
> > >
> > >
> > > "Bobby" wrote:
> > >
> > >> I use VNC and have to walk users through cmd > ipconfig to get there
IP
> > >> address. Is there a batch file I could place on their desktops to
> simply
> > >> click and display the address.
> > >>
> > >> Thanks.
> > >>
> > >>
> > >>
> >
> >
>
>
date: Sat, 6 Aug 2005 18:25:06 -0700   author:   Charles L. Phillips

Re: IPconfig script   
"Charles L. Phillips"  wrote in message
news:%231So4yumFHA.2152@TK2MSFTNGP14.phx.gbl...
> Hello,
> This is really cooolll...
> Can ANYONE suggest some books on VBScript???

  I am quite fond of this book:

Managing Enterprise Systems with the Windows Script Host:
http://amazon.com/exec/obidos/tg/detail/-/1893115674/
date: Sat, 6 Aug 2005 21:19:01 -0500   author:   James Whitlow

Re: IPconfig script   
Steve Wolfie wrote:

> Here's a variation that may be even easier...
> 
> create a shortcut on desktop with the target:
> 
> cmd /k  ipconfig
> 
> 
> Get creative and create a login script that will create this
> shortcut on each user's desktop, something like this:
> (snip)
> set winnet = createobject("Wscript.Network")
> set winshell = createobject("Wscript.Shell")
> set shortcut = winshell.createshortcut("C:\documents and settings\" &
> winnet.username & "\desktop\name of shortcut.lnk")
> 
> shortcut.targetpath = "cmd /k ipconfig"
> shortcut.save
Hi,

Never use username to get a user's profile path, because sometimes the
user profile path contains more than just the username (e.g.
<username>.<domain>, <username>.000, <username>.windows).

Some alternatives:

'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")

' Display path to user's Desktop folder
WScript.Echo oShell.SpecialFolders("Desktop")
WScript.Echo oShell.ExpandEnvironmentStrings("%UserProfile%\Desktop")


' Display path to All Users Desktop folder
WScript.Echo oShell.SpecialFolders("AllUsersDesktop")
'--------------------8<----------------------


Also note that for your IP config shortcut script to work, you will
need to use the .Arguments property of the CreateShortcut method.

Try this one:

'--------------------8<----------------------

Set oShell = CreateObject("WScript.Shell")

' Create shortcut in the Desktop folder
sUserDesktopPath = oShell.SpecialFolders("Desktop")

Set oShortCut = oShell.CreateShortcut( _
       sUserDesktopPath & "\IP Config.lnk")

oShortCut.TargetPath = "%comspec%"
oShortCut.Arguments = "/k ipconfig.exe"
oShortCut.Save

'--------------------8<----------------------



-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
date: Sun, 07 Aug 2005 21:10:41 +0200   author:   Torgeir Bakken \(MVP\)

Re: IPconfig script   
Charles L. Phillips wrote:

> Hello,
> This is really cooolll...
> Can ANYONE suggest some books on VBScript???
> 
Hi,

For admin scripting with VBScript I would say Microsoft Windows 2000
Scripting Guide:

http://www.microsoft.com/mspress/books/6417.asp
http://www.amazon.com/exec/obidos/ASIN/0735618674/002-7141687-9862444


Here are some other WSH/VBScript starting points:

Welcome to the Script Center
http://www.microsoft.com/technet/scriptcenter/default.mspx

The updated Portable Script Center (v3.0), the *.chm version of all of
the sample scripts on the TechNet Script Center site...

Download details: System Administration Scripting Guide Scripts
http://www.microsoft.com/downloads/details.aspx?displaylang=en&familyid=b4cb2678-dafb-4e30-b2da-b8814fe2da5a


For a list of some scripting resources and links to some Windows Script
Host (WSH) Web introductions, take a look here:

http://groups.google.co.uk/groups?selm=3FFC3C56.4C6A07C0@hydro.com






-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
date: Sun, 07 Aug 2005 21:14:21 +0200   author:   Torgeir Bakken \(MVP\)

Re: IPconfig script   
You also might want to download a free program called bginfo.
date: Mon, 8 Aug 2005 14:25:18 -0500   author:   de Graff

Re: IPconfig script   
Users cant' run the .vbs because they are only users/power users.



"de Graff"  wrote in message 
news:OZyMr7EnFHA.2180@TK2MSFTNGP15.phx.gbl...
> You also might want to download a free program called bginfo.
>
date: Wed, 10 Aug 2005 13:49:43 -0400   author:   Bobby

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us