Results 1 to 3 of 3

Thread: VBScript to Change My Computer Foldername

  1. #1
    kev147 is offline 30+ Helpful Posts 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    50

    Default

    This script will rename the My Computer folder to "My Computer %computername%"

    This is to be used in our organisation for remote administration purposes. eg we can easily ask the user for their computername, without having to talk them through running ipconfig etc.

    -------------------------------------------------------------------------------------
    option explicit

    dim objNetwork, objShell, strComputer, objFolder, objFolderItem
    Const MY_COMPUTER = &H11&

    Set objNetwork = CreateObject("Wscript.Network")
    Set objShell = CreateObject("Shell.Application")

    strComputer = objNetwork.ComputerName
    'msgbox strComputer

    Set objFolder = objShell.Namespace(MY_COMPUTER)
    Set objFolderItem = objFolder.Self
    objFolderItem.Name = "My Computer " & strComputer
    'msgbox objFolderItem.Name

    'Clears Environment
    Set objNetwork = nothing
    Set objShell = nothing
    Set objFolder = nothing
    Set objFolderItem = nothing
    -------------------------------------------------------------------------------------

  2. #2
    AdamV is offline 100+ Helpful Posts! 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    669

    Default

    Quote Originally Posted by kev147
    This script will rename the My Documents folder to "My Documents %username%"
    You mean "My Computer", not My Documents in this thread, I think...

  3. #3
    kev147 is offline 30+ Helpful Posts 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    50

    Default

    sorry about that guys. have just edited to be correct.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Friendly URLs by vBSEO