r/scripting • u/JoKeR2092 • Mar 18 '19
Need assistance editing a vbs logon-script
Hello,
I have a logon-script (https://pastebin.com/BBykUz84) which was not written by me originally. I don't know how to vbs and need a little tweak for it.
What it does: It creates 2 "log"-files. One locally and one on a hidden file share. The file on the hidden share has the name "username_computername.txt". Now, when a User logs into the same machine again, the name does not change. Only the date for last change.
What i need: The filename on the hidden file share should end with a counter. Everytime the user logs into a machine it counts one up. Like: "username_computername_counter.txt"
Thanks in advance
2
u/jcunews1 Mar 19 '19
Because the login script executes then terminates when it has completed all of its task, the counter must be stored in the file system. e.g.
loginScriptCounter.txt. Where its contents is just one line of the counter number. The file would be read then updated.So on that script, first, change line #47 to below line.
Then at line #46, insert below lines.
The script is made to use
1as the first counter number if the counter file is not yet exist. If its contents is not a string of number, the counter will be reset to1.0
u/Lee_Dailey Mar 18 '19
howdy JoKeR2092,
i can't help with VBS, but i can help you get help by fixing your reddit code formatting. [grin]
reddit likes to mangle code formatting, so here's some help on how to post code on reddit ...
[0] single line or in-line code
enclose it in backticks. that's the upper left key on an EN-US keyboard layout. the result
looks like this. kinda handy, that. [grin][on New.Reddit.com, use the
Inline Codebutton. it's4th5th from the lefthidden in the...""more" menu & looks like</>.this does NOT line wrap & does NOT side-scroll on Old.Reddit.com!]
[1] simplest = post it to a text site like Pastebin.com or Gist.GitHub.com and then post the link here.
please remember to set the file/code type on Pastebin! [grin] otherwise you don't get the nice code colorization.
[2] less simple = use reddit code formatting ...
[on New.Reddit.com, use the
Code Blockbutton. it's11th12th one & is just to the left ofhidden in the..."more" menu.]that will give you something like this ...
the easiest way to get that is ...
not complicated, but it is finicky. [grin]
take care,
lee