none
BATCH FILE GIVING ERROR THAT SUBSCRIPT OUT OF RANGE RRS feed

  • General discussion

  • THIS IS  MY VBS FILE ON REMOTE MACHINE

    Dim ObjExec
    Dim strfromproc

    Dim Date1,Date2,Result
    Set oShell = WScript.CreateObject ("Wscript.Shell") 
    Set objExec = oShell.Exec ("cmd.exe /C ""net user 06172adm /domain | find ""Password expires""""")
    x = objExec.StdOut.ReadLine
    y=split(x," ")
    Date2=y(14)

    Date1 = DateInfo & Date & VbCrLf


    If DateValue(Date1) <  DateValue(Date2) Then
    Result="password is valid"

    Else
    Result = "Your server password expires, Please change it first then run this script"

    End If


    wscript.quit

    BELOW IS MY BATCH FILE ON LOCAL MACHINE

    @echo off


    set counter=0
    set SCRIPTFOLDER=D:\patchcopy
    For /F "tokens=1,2 delims=," %%G IN (plist.txt) DO (
    echo branch ID :%%H
    set username= KKKK%%Hsvr1\bsc%%Husr
    set password=TTTT
    net use t: \\%%G\c$ /User:SBI%%Hsvr1\bsc%%Husr Ibs#csb2K

    %SCRIPTFOLDER%\psexec.EXE -accepteula \\%%G -u bsc%%Husr -p Ibs#csb2K cmd.exe /c "FOR /F"usebackq=*"%r%r in(' cscript.exe /nologo "c:\Users\06172adm\Desktop\sachin.vbs" ') DO SET Result=%r%r"
    echo %Result%

    net use t: /delete
    set /a counter=counter+1
    )

    sACHIN: NOT SURE WHY THIS ERROR IS COMING ....PLZ HELP

    • Changed type Bill_Stewart Wednesday, September 13, 2017 8:42 PM
    • Moved by Bill_Stewart Wednesday, September 13, 2017 8:43 PM This is not "fix/debug/rewrite my script for me" forum
    Monday, July 17, 2017 10:35 AM

All replies

  • Sorry, we can't help debug scripts for your specific environment.

    Is the purpose to change local passwords on a server? You don't need a batch file, the net use command, or psexec to accomplish that. There should be examples in the repository.


    -- Bill Stewart [Bill_Stewart]

    Monday, July 17, 2017 2:14 PM
  • It is not necessary to remote a user for the user to change password.

    net user  %username% pass12@word34


    \_(ツ)_/

    Monday, July 17, 2017 2:52 PM
  • Hi Bill 

    I am not changing password.

    i am checking the password status of remote server thru vbs and retreiving the result back to batch file..which is not happenning .

    It is not specific to my environment as  i am not able to figure why vbs script 9Result="password is valid") is not retreieved in batch file .

    Regards

    Sachin

    Tuesday, July 18, 2017 10:06 AM
  • Sorry, but we're not able to debug this for you. I'm pretty certain you don't need batch, VBScript, and psexec to do whatever it is you're trying to do. (This is also not the right place to ask psexec questions.)


    -- Bill Stewart [Bill_Stewart]

    Tuesday, July 18, 2017 12:39 PM