Windows 10: VBS Script Renaming a pc script fails

Discus and support VBS Script Renaming a pc script fails in Windows 10 Support to solve the problem; can anyone tell me why this script fails with rc=5.. I am not very well versedin resolving scripts.... MUCH APPRECIATED IN ADVANCE! Const... Discussion in 'Windows 10 Support' started by changari, Feb 21, 2018.

  1. changari Win User

    VBS Script Renaming a pc script fails


    can anyone tell me why this script fails with rc=5.. I am not very well versedin resolving scripts....
    MUCH APPRECIATED IN ADVANCE!


    Const JOIN_DOMAIN = 1
    Const ACCT_CREATE = 2
    Const ACCT_DELETE = 4
    Const WIN9X_UPGRADE = 16
    Const DOMAIN_JOIN_IF_JOINED = 32
    Const JOIN_UNSECURE = 64
    Const MACHINE_PASSWORD_PASSED = 128
    Const DEFERRED_SPN_SET = 256
    Const INSTALL_INVOCATION = 262144
    Name = InputBox("Enter asset tag number:", "Identify Computer")
    username = "addcomputer"
    password = "XXXXXX"
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!" & strComputer & "\root\cimv2")
    Set colComputers = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
    For Each objComputer in colComputers
    err = objComputer.Rename(Name, Password, Username)
    If Err.Number = 0 Then
    WScript.Echo "Successfully renamed computer to " & name & "!"
    WScript.Echo "*** NOTE : You !MUST! restart pc for name change to take effect!"
    WScript.Echo "*** NOTE : You !MUST! restart pc for name change to take effect!"
    WScript.Echo "*** NOTE : You !MUST! restart pc for name change to take effect!"
    Call endit
    Else
    WScript.Echo "An error occurred renaming the computer!"
    WScript.Echo "Error Number: " & Err.Number
    WScript.Echo "Error" & Err.Description
    End If
    Next
    Sub endit
    End Sub

    :)
     
    changari, Feb 21, 2018
    #1

  2. Restoration impossible after PC Suite update

    Great VB script! Thanks a lot! Just wanted to add that instead of renaming contacts.dat you can directly use PCCSContact.db file which present in the same folder.
     
    rahulkumar1111, Feb 21, 2018
    #2
  3. JonDresser, Feb 21, 2018
    #3
  4. changari Win User

    VBS Script Renaming a pc script fails

    Byt the way .. this is being run on Windows 10 64 bit machines.
     
    changari, Feb 21, 2018
    #4
Thema:

VBS Script Renaming a pc script fails

Loading...
  1. VBS Script Renaming a pc script fails - Similar Threads - VBS Script Renaming

  2. failed to execute script

    in Windows 10 Gaming
    failed to execute script: hello,i am trying to open A third party APP I have,was working fine until the other day,i get failed to execute script when I try to open it,i also have the following info connected to problem, Traceback (most recent call last): File "ATSinstaller.pyw",...
  3. Script

    in Windows 10 Network and Sharing
    Script: My PC pauses during certain responses with Script running too long https://answers.microsoft.com/en-us/windows/forum/all/script/4728a281-bc5c-45f8-9874-4925c8de4c84
  4. VBS Script crashing in Windows 10: More RAM?

    in Windows 10 BSOD Crashes and Debugging
    VBS Script crashing in Windows 10: More RAM?: Hi there, I have a VBS script that I've used for years that is suddenly crashing. I get this in the event log under "application error" and no other pop-ups or messages: Faulting application name: DllHost.exe, version: 10.0.17134.1, time stamp: 0x5cfd3427 Faulting...
  5. failed to execute script

    in Windows 10 BSOD Crashes and Debugging
    failed to execute script: hello,i use a game from steam & i use a separate programme(3rd party)to install items on it,it was working perfectly up to yesterday,when i open the app & click on an item i get the following failed to execute script,i have un/reinstalled it but no joy,any help would be...
  6. Script

    in AntiVirus, Firewalls and System Security
    Script: Hi All, Is there any script for updating all the servers. https://answers.microsoft.com/en-us/protect/forum/all/script/c059b854-e8d9-4542-ae11-6876910c27d5
  7. Cannot find script file 1.vbs

    in Windows 10 BSOD Crashes and Debugging
    Cannot find script file 1.vbs: I keep on receiving a Windows script file error saying Cannot find script file "C:\ProgramData\Windows\profile\1.vbs" I have run a malware scan multiple times but i still keep on getting this error....
  8. A vbs script to create a system restore point?

    in Windows 10 Support
    A vbs script to create a system restore point?: Hi. I have always used this vbs script in Windows 7.. it brings up a dialogue box, into which you enter your restore point naem, and that's it. Works a charm. But I can't see how to adapt it so that it will work in Windows 10? Can anyone kindly help? Thanks! Code:...
  9. cannotfind script filec:\programdata\lenovo-23677.vbs

    in Windows 10 Customization
    cannotfind script filec:\programdata\lenovo-23677.vbs: Please help me remove this aggravating pop up https://answers.microsoft.com/en-us/windows/forum/windows_10-start-win_desk/cannotfind-script-filecprogramdatalenovo-23677vbs/ec349184-6c86-4116-b872-1930f6497311
  10. A vbs script intended to check for updates does not work.

    in Windows 10 Updates and Activation
    A vbs script intended to check for updates does not work.: The following vbs script was copied from this page. Set automaticUpdates = CreateObject("Microsoft.Update.AutoUpdate") automaticUpdates.DetectNow() It does not work at my end because no updates are shown as available when they are available. Does it work at your end?...