Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. System Admin
  4. script???

script???

Scheduled Pinned Locked Moved System Admin
toolshelpwindows-adminlinuxquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jlawren7
    wrote on last edited by
    #1

    not sure if i should post here or not, but need some help wit a error i keep getting here is the code ******************************************* 'Jim Lawrence 'Change PC Name Utility Option explicit Set ws = WScript.CreateObject("WScript.Shell") Dim ws, Regkey1, RegKey2, PCName , p1, g, Title Dim itemtype RegKey1 = "HKLM\system\currentcontrolset\control\ComputerName\" p1 = ws.RegRead(RegKey1 & " ComputerName")<----- Error Here see below ***** 'g = ws.RegRead(RegKey2 & " ComputerName") Title = "Change Computer Name Utility" MsgBox n PCName = InputBox("Type the new PC Name", Title, NM) If PCName <> "" Then ws.RegWrite RegKey1 & "ComputerName", PCName End If ************************************************* Unabe to open registry key "HKLM\system\currentcontrolset\control\ComputerName\ComnputerName" for reading code: 80070002 Source: WshShell.RegRead Any ideas will be greatly appreciated thanks in advanced

    L 1 Reply Last reply
    0
    • J jlawren7

      not sure if i should post here or not, but need some help wit a error i keep getting here is the code ******************************************* 'Jim Lawrence 'Change PC Name Utility Option explicit Set ws = WScript.CreateObject("WScript.Shell") Dim ws, Regkey1, RegKey2, PCName , p1, g, Title Dim itemtype RegKey1 = "HKLM\system\currentcontrolset\control\ComputerName\" p1 = ws.RegRead(RegKey1 & " ComputerName")<----- Error Here see below ***** 'g = ws.RegRead(RegKey2 & " ComputerName") Title = "Change Computer Name Utility" MsgBox n PCName = InputBox("Type the new PC Name", Title, NM) If PCName <> "" Then ws.RegWrite RegKey1 & "ComputerName", PCName End If ************************************************* Unabe to open registry key "HKLM\system\currentcontrolset\control\ComputerName\ComnputerName" for reading code: 80070002 Source: WshShell.RegRead Any ideas will be greatly appreciated thanks in advanced

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Try to check the information from here[^]. On the other hand, I think you should put the complete name in the path to the specific place in the registry key. jlawren7 wrote: HKLM\system\currentcontrolset\control\ComputerName\ComnputerName It should change too: HKEY_LOCAL_MACHINE\system\currentcontrolset\control\ComputerName\ComnputerName or: My Computer\HKEY_LOCAL_MACHINE\system\currentcontrolset\control\ComputerName\ComnputerName Good luck


      A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office

      J 1 Reply Last reply
      0
      • L Lost User

        Try to check the information from here[^]. On the other hand, I think you should put the complete name in the path to the specific place in the registry key. jlawren7 wrote: HKLM\system\currentcontrolset\control\ComputerName\ComnputerName It should change too: HKEY_LOCAL_MACHINE\system\currentcontrolset\control\ComputerName\ComnputerName or: My Computer\HKEY_LOCAL_MACHINE\system\currentcontrolset\control\ComputerName\ComnputerName Good luck


        A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office

        J Offline
        J Offline
        jlawren7
        wrote on last edited by
        #3

        tried both, no avail the key does exist cuz i copied and pasted the key into my script has to be some where else in the registry that changes the PC name

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups