locked
auto-create text file on desktop with the name of current ip address of the system RRS feed

  • Question

  • how friends

    our manager has asked me an strange demand

    he asked me for a solution so that when our domain users log on to their computer, a text file or a file without extension be created on their desktop which the name of this file is the ip address of their computer, so that they easily see their system's ip address on desktop & announce it when he asks them.

    also every time they logon, if their ip address has been changed (for example because their are DHCP client), the old file been removed & their new ip address be located on the desktop ( this file dynamically be updated)

    off course there are multiple methods to view ip address via cmd & powershell, but how can i provide them a file on their desktop which it's name is for example 192.168.1.100?

    i guess maybe it is possible via a logon script? but don't know what should exactly do.

    any guidance please

    thanks in advanced

    Wednesday, December 3, 2014 10:39 AM

Answers

  • i guess maybe it is possible via a logon script?

    You could insert this line into your logon script:

    ipconfig | find /i "ipv4" > "%UserProfile%\Desktop\IP Address.txt"

    • Marked as answer by john.s2011 Wednesday, December 3, 2014 12:10 PM
    Wednesday, December 3, 2014 10:51 AM
  • Use GP to distribute this utility from Microsoft: http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx

    You can add as much or as little info as you want.  By default it shows computername, IP and user ID.  All elements can be custmized with a simple setting.

    Your boss wil think you are a true wizard.


    ¯\_(ツ)_/¯



    • Edited by jrv Wednesday, December 3, 2014 11:23 AM
    • Marked as answer by john.s2011 Wednesday, December 3, 2014 12:10 PM
    Wednesday, December 3, 2014 11:23 AM
  • i need the name of the file also be the same as current ip address.

    This makes things a little harder . . .

    for /F "tokens=2 delims=:" %%a in ('ipconfig ^| find /i "ipv4"') do echo %%a > "%UserProfile%\Desktop\%%a.txt"

    • Marked as answer by john.s2011 Wednesday, December 3, 2014 1:58 PM
    Wednesday, December 3, 2014 12:57 PM

All replies

  • i guess maybe it is possible via a logon script?

    You could insert this line into your logon script:

    ipconfig | find /i "ipv4" > "%UserProfile%\Desktop\IP Address.txt"

    • Marked as answer by john.s2011 Wednesday, December 3, 2014 12:10 PM
    Wednesday, December 3, 2014 10:51 AM
  • Use GP to distribute this utility from Microsoft: http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx

    You can add as much or as little info as you want.  By default it shows computername, IP and user ID.  All elements can be custmized with a simple setting.

    Your boss wil think you are a true wizard.


    ¯\_(ツ)_/¯



    • Edited by jrv Wednesday, December 3, 2014 11:23 AM
    • Marked as answer by john.s2011 Wednesday, December 3, 2014 12:10 PM
    Wednesday, December 3, 2014 11:23 AM
  • Hi jrv & Ferederik

    really thanks to both of you. you really help me resolving my problems & learning useful things.

    don't know how to thanks you.

    best regards 

    Wednesday, December 3, 2014 12:12 PM
  • i guess maybe it is possible via a logon script?

    You could insert this line into your logon script:

    ipconfig | find /i "ipv4" > "%UserProfile%\Desktop\IP Address.txt"

    Frederik, thanks a alot. that's great but only one little thing.

    the name of this file is "ip address.txt" , but i need the name of the file also be the same as current ip address.   i am familiar ren command which renames files , but don't know how to use it in this scenario

    Wednesday, December 3, 2014 12:16 PM
  • i need the name of the file also be the same as current ip address.

    This makes things a little harder . . .

    for /F "tokens=2 delims=:" %%a in ('ipconfig ^| find /i "ipv4"') do echo %%a > "%UserProfile%\Desktop\%%a.txt"

    • Marked as answer by john.s2011 Wednesday, December 3, 2014 1:58 PM
    Wednesday, December 3, 2014 12:57 PM
  • i need the name of the file also be the same as current ip address.

    This makes things a little harder . . .

    for /F "tokens=2 delims=:" %%a in ('ipconfig ^| find /i "ipv4"') do echo %%a > "%UserProfile%\Desktop\%%a.txt"

    WOW, excellent.

    really thanks, really appreciate your knowledge.

    command prompt & powershell are really great & interesting worlds

    Wednesday, December 3, 2014 1:59 PM