Log in Vbscript

Asked

Viewed 348 times

0

I need to create a log to see who used my script, and this log has to go to a txt.

Below is the procedure, as I create this log that contains the user and the date

On Error Resume Next

Dim errorLevel

Set WSHShell = CreateObject("WScript.Shell")
Set WshNetwork = CreateObject("WScript.Network")


VAR1 = InputBox ("Informe o nome da impressora", "Mapeamento de impressora", "Escreva o nome da impressora")

resp = MsgBox("Favor aguardar 5 minutos para finalizar o processo de mapeamento", vbokonly + vbInformationtisdesk, "Mapeamento de impressora")

WshNetwork.AddWindowsPrinterConnection "\\BRU02\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\CNO03\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\CPZ05\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\CTV02\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\CWBPS01BRF\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\EBU04\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\EBU16\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\HOR137\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\HORXPS01BRF\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\HORXPS02BRF\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\HORXPS03BRF\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\IAI03\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\IAI19\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\IAI22\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\MNE02\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\MRU03\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\NVM02\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\RVE06\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\RVE10\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\RVE11\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\SEC02\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\SPO37\"+VAR1,true
WshNetwork.AddWindowsPrinterConnection "\\VDA16\"+VAR1,true


resp = MsgBox("    Por gentileza verificar se a impressora foi mapeada."& vbCrLf &"Caso nao tenha sido, favor entrar em contato com Help Desk de TI", vbokonly + vbInformationtisdesk, "Mapeamento de impressora")

WshShell.run("control printers")

On hold.

  • Wouldn’t it be the case to create a 'log' function and insert within that function? You want a function model to generate a log file in TXT, that’s it?

  • That’s right, I need that when the user accesses this script he edits the txt that is on the public server and fills the txt with id(user) and date

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.