vbscript - A bit complex Vbs -


i have create vscript bit complex, @ least me.. if help, thank much! :d

these tasks script needs take care of:

*-run cmd file located on "c:\program files\paradigm\paradigm-15\services\bin\cli\pg_epos_user_list.cmd" -pns_host localhost 

that cmd generates list of users so, cmd's output, need check if current logged accountname listed there (check if matches)*

-if not listed, run cmd -> "c:\program files\paradigm\paradigm-15\services\bin\cli\pg_epos_user_create.cmd" -pns_host localhost -epos_user -member_list

but in case, have input logged userid on each "" on commandline.

then, compare content on ini file, stored on shared disk, values on 2 files located on c:\programdata\paradigm\paradigm-15\applications\config\env\common\

1_epos_license_location  & 1_epos_license_location.tcl  

get license value section "[license]" value stratimagic=**licensevalue** , sure matches license info on both 1_epos_license_location & 1_epos_license_location.tcl.

if not matches, update both files. also, check if w disk mapped, if not, advise msgbox

thanks guys!,i have far (working), italic part, working.

dim objshell      sub runcommand(strcommand)        dim oshell        set oshell = createobject("wscript.shell")        oshell.run strcommand, 0, true     end sub  private function file2output(tempfile)         set fso = createobject("scripting.filesystemobject")         set txtstream = fso.opentextfile(tempfile, 1)         out = ""         out = txtstream.readall         txtstream.close         fso.deletefile tempfile         file2output = out end function   call runcommand("%comspec% /c ""c:\program files\paradigm\paradigm-15\services\bin\cli\pg_epos_user_list.cmd"" -pns_host localhost > c:\log.txt")  set objnetwork = createobject("wscript.network")  user = objnetwork  cmdout = file2output("c:\log.txt") 'wscript.echo cmdout 'wscript.echo user 'wscript.echo instr(cmdout, user) if instr(cmdout, user) > 0                 wscript.echo "found" else                 wscript.echo "not found" end if 

thanks in advance!, regards

sub runcommand(strcommand)    dim oshell    set oshell = createobject("wscript.shell")    objshell.run strcommand, 0, true end sub 

to run commands:

this call sub , run command. last portion of command (> c:\temp\log.txt) dump results of command log.txt file, right after execution can open file , parse results, allowing make decisions on how proceed script.

call runcommand("%comspec% /c c:\program files\paradigm\paradigm-15\services\bin\cli\pg_epos_user_list.cmd > c:\temp\log.txt") 

then, current user:

set objnetwork = createobject("wscript.network") wscript.echo "the current user " & objnetwork.username 

** further reference on run method: https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.84).aspx

hope helps.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -