-
GRAZIE PETOce l'ho fatta ed è anche merito tuo

però, ci ho messo 3 ore e mezza, considerando che mi ci sono messo alle 15 e mi hanno cacciato fuori dalle poste alle 18 e mezza... mi sembrava di averci messo una vita!
appena ho voglia di accendere il porcatile ti posto la cosa, sia mai possa malauguratamente servirti....-
-
Re: GRANDISSIMO PETOTANT
- Scritto da: Svyatopolk
> E` il migliore!
toh ciapa
Const SERVER_ALT = "\\babbacammelli\D$\" Const strComputer = "babbacammelli" Const DOMINIO = "dominio\" Const FS = 0 set objShell = CreateObject("Wscript.Shell") set fso=CreateObject("Scripting.FileSystemObject") set ots=fso.opentextfile("Condivisioni.csv") DIm objWMIService Dim objNewShare Dim strSharePath Dim strShareName Dim strShareDesc 'oggetto Win32_Share per la condivisione Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set objNewShare = objWMIService.Get("Win32_Share") do while not ots.AtEndOfStream s=ots.readline vals=Split(s,";",-1,1) cartella=vals(0) utente=vals(1) permesso=vals(2) Wscript.Echo "cartella=" & cartella & " utente=" & utente & " permesso=" & permesso remotePath=SERVER_ALT & cartella If fso.FolderExists(remotePath) then Wscript.Echo "La cartella " & cartella & " esiste." Else Wscript.Echo "La cartella " & cartella & " esiste solo nella tua mente." fso.CreateFolder(remotePath) 'condivide la cartella con Everyone in scrittura: strSharePath = "d:\" & cartella strShareName = cartella strShareDesc = "Cartella condivisa automaticamente" wscript.echo "La cartella " & strSharePath & " verra' condivisa con nome " & strShareName errReturn = objNewShare.Create (strSharePath, strShareName, FS, , strShareDesc) wscript.echo "Errore: " & errReturn 'Elimina permessi NTFS superflui intRunError=objShell.Run("%COMSPEC% /c cacls """ & remotePath & """ /T /E /R ""NT AUTHORITY\Authenticated users""",,True) intRunError=objShell.Run("%COMSPEC% /c cacls """ & remotePath & """ /T /E /R ""BUILTIN\Users""",,True) End If intRunError=objShell.Run("%COMSPEC% /c cacls """ & remotePath & """ /T /E /R " & DOMINIO & utente,,True) intRunError=objShell.Run("%COMSPEC% /c cacls """ & remotePath & """ /T /E /G " & DOMINIO & utente & ":" & permesso,,True) loop ots.close
è un puttanaio perché alcune variabili sono dichiarate e altre no, lo stile è diverso a seconda dei copia&incolla ecc, però funziona...-
Re: GRANDISSIMO PETOTANT- Scritto da: Caccola
>
> - Scritto da: Svyatopolk
> > E` il migliore!
>
> toh ciapa
>
>Const SERVER_ALT = "\\babbacammelli\D$\" > Const strComputer = "babbacammelli" > Const DOMINIO = "dominio\" > Const FS = 0 > > set objShell = CreateObject("Wscript.Shell") > set fso=CreateObject("Scripting.FileSystemObject") > set ots=fso.opentextfile("Condivisioni.csv") > > DIm objWMIService > Dim objNewShare > Dim strSharePath > Dim strShareName > Dim strShareDesc > > 'oggetto Win32_Share per la condivisione > Set objWMIService = GetObject("winmgmts:" & > "{impersonationLevel=impersonate}!\\" & > strComputer & > "\root\cimv2") > Set objNewShare = > objWMIService.Get("Win32_Share") > > do while not ots.AtEndOfStream > s=ots.readline > vals=Split(s,";",-1,1) > cartella=vals(0) > utente=vals(1) > permesso=vals(2) > Wscript.Echo "cartella=" & cartella & " > utente=" & utente & " permesso=" & > permesso > remotePath=SERVER_ALT & cartella > If fso.FolderExists(remotePath) then > Wscript.Echo "La cartella " & cartella & > " > esiste." > Else > Wscript.Echo "La cartella " & cartella & > " esiste solo nella tua > mente." > fso.CreateFolder(remotePath) > 'condivide la cartella con Everyone in > scrittura: > strSharePath = "d:\" & cartella > strShareName = cartella > strShareDesc = "Cartella condivisa > automaticamente" > wscript.echo "La cartella " & strSharePath & " > verra' condivisa con nome " & > strShareName > errReturn = objNewShare.Create (strSharePath, > strShareName, FS, , > strShareDesc) > wscript.echo "Errore: " & errReturn > > > 'Elimina permessi NTFS superflui > intRunError=objShell.Run("%COMSPEC% /c cacls > """ & remotePath & """ /T /E /R ""NT > AUTHORITY\Authenticated > users""",,True) > intRunError=objShell.Run("%COMSPEC% /c cacls > """ & remotePath & """ /T /E /R > ""BUILTIN\Users""",,True) > > > End If > intRunError=objShell.Run("%COMSPEC% /c cacls """ > & remotePath & """ /T /E /R " & DOMINIO & > utente,,True) > intRunError=objShell.Run("%COMSPEC% /c cacls > """ & remotePath & """ /T /E /G " & DOMINIO & > utente & ":" & > permesso,,True) > > loop > ots.close
>
> è un puttanaio perché alcune variabili sono
> dichiarate e altre no, lo stile è diverso a
> seconda dei copia&incolla ecc, però
> funziona...
Per fare i pignoli dovresti pure controllare intRunError che altro non è che l'exit code. Se è diverso da 0 qualcosa non è andato come si deve. Così avresti il tool definitivo, l'avve-swiss-knife dei permessi di rete archiviati su csv.
-
Re: GRANDISSIMO PETOTANT
- Scritto da: Svyatopolk
> - Scritto da: Caccola
> >
> > - Scritto da: Svyatopolk
> > > E` il migliore!
> >
> > toh ciapa
> >
> >Const SERVER_ALT = "\\babbacammelli\D$\" > > Const strComputer = "babbacammelli" > > Const DOMINIO = "dominio\" > > Const FS = 0 > > > > set objShell = CreateObject("Wscript.Shell") > > set> fso=CreateObject("Scripting.FileSystemObject") > > set ots=fso.opentextfile("Condivisioni.csv") > > > > DIm objWMIService > > Dim objNewShare > > Dim strSharePath > > Dim strShareName > > Dim strShareDesc > > > > 'oggetto Win32_Share per la condivisione > > Set objWMIService = GetObject("winmgmts:" & > > "{impersonationLevel=impersonate}!\\" & > > strComputer & > > "\root\cimv2") > > Set objNewShare = > > objWMIService.Get("Win32_Share") > > > > do while not ots.AtEndOfStream > > s=ots.readline > > vals=Split(s,";",-1,1) > > cartella=vals(0) > > utente=vals(1) > > permesso=vals(2) > > Wscript.Echo "cartella=" & cartella & " > > utente=" & utente & " permesso=" & > > permesso > > remotePath=SERVER_ALT & cartella > > If fso.FolderExists(remotePath) then > > Wscript.Echo "La cartella " & cartella & > > " > > esiste." > > Else > > Wscript.Echo "La cartella " & cartella & > > " esiste solo nella tua > > mente." > > fso.CreateFolder(remotePath) > > 'condivide la cartella con Everyone in > > scrittura: > > strSharePath = "d:\" & cartella > > strShareName = cartella > > strShareDesc = "Cartella condivisa > > automaticamente" > > wscript.echo "La cartella " & strSharePath & " > > verra' condivisa con nome " & > > strShareName > > errReturn = objNewShare.Create (strSharePath, > > strShareName, FS, , > > strShareDesc) > > wscript.echo "Errore: " & errReturn > > > > > > 'Elimina permessi NTFS superflui > > intRunError=objShell.Run("%COMSPEC% /c cacls > > """ & remotePath & """ /T /E /R ""NT > > AUTHORITY\Authenticated > > users""",,True) > > intRunError=objShell.Run("%COMSPEC% /c cacls > > """ & remotePath & """ /T /E /R > > ""BUILTIN\Users""",,True) > > > > > > End If > > intRunError=objShell.Run("%COMSPEC% /c cacls > """ > > & remotePath & """ /T /E /R " & DOMINIO & > > utente,,True) > > intRunError=objShell.Run("%COMSPEC% /c cacls > > """ & remotePath & """ /T /E /G " & DOMINIO & > > utente & ":" & > > permesso,,True) > > > > loop > > ots.close
> >
> > è un puttanaio perché alcune variabili sono
> > dichiarate e altre no, lo stile è diverso a
> > seconda dei copia&incolla ecc, però
> > funziona...
>
> Per fare i pignoli dovresti pure controllare
> intRunError che altro non è che l'exit code. Se è
> diverso da 0 qualcosa non è andato come si deve.
> Così avresti il tool definitivo,
> l'avve-swiss-knife dei permessi di rete
> archiviati su csv.
>
sì c'hai ragione, ora sto cercando di estorcere al mio "capo" il significato di questa cosa, il problema è che secondo me lui si illude che noi sysadmin di poste siamo o potremo mai essere qualcosa di più di tecnici che installano le cose col kit. Oh beato lui che ci crede.
Intanto c'è il mio capo, senza le virgolette, che mi chiama (o chiama il mio collega) per qualsiasi stronzata dall'attaccare il proiettore al cambiare la temperatura della stanza.
Brutta cosa avere due capi...
-
-
-
-