Ir a contenido


MENSAJE DE BIENVENIDA Foro vínculado con Twitter, más info aquí.

“El secreto para progresar es empezar por algún lugar. El secreto para empezar por algún lugar es fragmentar tus complejas y abrumadoras tareas de tal manera que queden convertidas en pequeñas tareas que puedas realizar y entonces simplemente comenzar por la primera.” - Mark Twain

Foto

Script para compartir carpeta y asignar permisos a dos usuarios o grupos


  • Please log in to reply
No replies to this topic

#1 Alberto Dominguez

Alberto Dominguez

    Gurú

  • Administradores
  • 1.059 Mensajes:
  • LocationMadrid

Escrito 17 agosto 2012 - 13:42

Os dejo este interesante script para compartir carpetas de forma masiva con SCCM:

Foldername="c:\Prueba" 'folder to share
sharename="Probando" 'Share Name
strDesc="Descripcion Prueba" 'Share Description
strUser="UsuarioPrueba" 'User or group to set permissions for
strUser2="GrupoPrueba" 'User2 or group2 to set permissions for

Set Services = GetObject("winmgmts:{impersonationLevel=impersonate,(Security)}!\\.\root\cimv2")
' Connects to the WMI service with security privileges
Set SecDescClass = Services.Get("Win32_SecurityDescriptor")
' Need an instance of the Win32_SecurityDescriptor so we can create an instance of a Security Descriptor.
Set SecDesc = SecDescClass.SpawnInstance_()
' Create an instance of a Security Descriptor.

'*** Primer Usuario o Grupo ***

Set colWinAcc = Services.ExecQuery("SELECT * FROM Win32_ACCOUNT WHERE Name='" & strUser & "'")
If colWinAcc.Count < 1 Then
Wscript.echo("User " & strUser & "Not Found - quitting")
wscript.quit
End If
For Each refItem in colWinAcc
Set refSID = Services.Get("Win32_SID='" & refItem.SID & "'")
' Get the SID for the choosen Windows account.
Next
Set refTrustee = Services.Get("Win32_Trustee").spawnInstance_()
' Creates an instance of a Windows Security Trustee (usually a user but anything with a SID I guess...)
With refTrustee
.Domain = refSID.ReferencedDomainName
.Name = refSID.AccountName
.SID = refSID.BinaryRepresentation
.SidLength = refSID.SidLength
.SIDString = refSID.SID
End With
' Sets the trustee object up with the SID & all that malarkey from the user object we have choosen to work on
Set ACE = Services.Get("Win32_Ace").SpawnInstance_
' Creates an instance of an Access Control Entry Object(this will be one entry on the access list on an object)
ACE.Properties_.Item("AccessMask") = 2032127 '2032127 = "Full"; 1245631 = "Change"; 1179817 = "Read"
' This is full Control ' This is full Control (bitflag) full list here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_ace.asp
ACE.Properties_.Item("AceFlags") = 3
' what to apply ACE to inc inhehitance 3 - means files & folders get permssions & pass onto children
ACE.Properties_.Item("AceType") = 0
' 0=allow access 1=deny access
ACE.Properties_.Item("Trustee") = refTrustee
' Set the Trustee (user) that this Access control Entry will refer to.

'*** Segundo Usuario o Grupo ***

Set colWinAcc2 = Services.ExecQuery("SELECT * FROM Win32_ACCOUNT WHERE Name='" & strUser2 & "'")
If colWinAcc2.Count < 1 Then
Wscript.echo("User " & strUser2 & "Not Found - quitting")
wscript.quit
End If
' Find the WMI representation of a particular Windows Account
For Each refItem in colWinAcc2
Set refSID2 = Services.Get("Win32_SID='" & refItem.SID & "'")
' Get the SID for the choosen Windows account.
Next
Set refTrustee2 = Services.Get("Win32_Trustee").spawnInstance_()
' Creates an instance of a Windows Security Trustee (usually a user but anything with a SID I guess...)
With refTrustee2
.Domain = refSID2.ReferencedDomainName
.Name = refSID2.AccountName
.SID = refSID2.BinaryRepresentation
.SidLength = refSID2.SidLength
.SIDString = refSID2.SID
End With
' Sets the trustee object up with the SID & all that malarkey from the user object we have choosen to work on
Set ACE2 = Services.Get("Win32_Ace").SpawnInstance_
' Creates an instance of an Access Control Entry Object(this will be one entry on the access list on an object)
ACE2.Properties_.Item("AccessMask") = 1179817 '2032127 = "Full"; 1245631 = "Change"; 1179817 = "Read"
' This is Read (bitflag) full list here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_ace.asp
ACE2.Properties_.Item("AceFlags") = 3
' what to apply ACE to inc inhehitance 3 - means files & folders get permssions & pass onto children
ACE2.Properties_.Item("AceType") = 0
' 0=allow access 1=deny access
ACE2.Properties_.Item("Trustee") = refTrustee2
' Set the Trustee (user) that this Access control Entry will refer to.

'*** Lista ACL ***

Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "Empty Key", ACE
objDictionary.Add "Empty Key2", ACE2
' Create Temporal ACL on a Dictionary object

SecDesc.Properties_.Item("DACL") = objDictionary.Items
' SecDesc.Properties_.Item("DACL") = Array(ACE)
' Get the DACL property of the Security Descriptor object
' Add the ACE to the Dynamic Access Control List on the object (an array) it will overwrite the old entries
' unless you retreive & save 'em first & add them to a big array with the new entry as well as the old ones
Set Share = Services.Get("Win32_Share")
' Get a WMI share Object
Set InParam = Share.Methods_("Create").InParameters.SpawnInstance_()
' Create an instance of a WMI input Parameters object
InParam.Properties_.Item("Access") = SecDesc
' Set the Access Parameter to the Security Descriptor Object we configured above
InParam.Properties_.Item("Description") = strDesc
InParam.Properties_.Item("Name") = ShareName
InParam.Properties_.Item("Path") = FolderName
InParam.Properties_.Item("Type") = 0
Set outParams=Share.ExecMethod_("Create", InParam)
' Create the share with all the parameters we have set up
wscript.echo("OUT: " & outParams.returnValue)
If outParams.returnValue <> 0 Then
wscript.echo("Failed to Create Share, return Code:" & outParams.returnValue)
Else
wscript.echo("Folder " & Foldername & " sucessfully shared as: " & sharename & " with FULL CONTROL Permissions for user " & strUser _
& " and READ Permissions for user " & strUser2)
End If



Más info para tratamiento de la lista ACL:

http://www.autoitscr...dacl-using-wmi/
Saludos,

Alberto Dominguez

Enterprise Architect y Trainer
MCT, MCPD, MCITP, MCITP Dynamics, MCSE, MCSA, MCTS, MCP...
ITIL V3 Foundation Qualification in IT Service Management
Imagen enviadaPerfil Profesional Imagen enviadaTwitter
Imagen enviadaImagen enviadaImagen enviadaImagen enviada

#2 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 08 julio 2017 - 11:45

ce Age 2: The Meltdown (PS2) 2006

faispascifaispasca2007
The Daily Show with Jon Stewart Season 22 Episode 118 s22e118


ommunication Networks for Smart Grids: Making Smart Grid Real (Computer Communications and Networks)

Running Wild
HD Buster's Mal Heart
The Walking Dead Season 8 Episode 4



Share and comment

RAYMAN OST by STEPHANE BELLANGER 1995 rar
Party of Five
Passengers BluRay-Screeener


Kong: A Ilha da Caveira assistir online Dublado

Видео о Рыбалке
Headhunters 2011 BRRip XviD-playXD_arc avi


WisiZockt

Viva Pinata
Sonu Kakkar Teri Umeed Mp3
Historica
Watch Supergirl
Nowhere Boy (2009)


#3 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 08 julio 2017 - 11:53

Gru 3: Mi villano favorito

The Sense of an Ending (2017) El sentido de un final
Season 5 Episode 1
Ryan Higa
Workin' Moms


Thriller (343)

The Living and the Dead
Arnold Schwarzenegger Movies
American Exorcism (2017)
Ein Herz und eine Seele



watch on Vidzi.tv

Netherlands
aman kadyrow
Uploader un Torrent
Скачать торрент »


Die Welt Der Lust Erotische Phantasien Volume 4 2011 3D Complete Bluray - iND

There For You Single
Manje Bistre (2017) Watch Online Punjabi Full Movie
Peliculas De Western
Graphics


aterciopelados el album

Pogledaj ovo
Scent of a Woman (1992) BluRay 480p English Download
The Carrie Diaries
The Vampire Diaries
Watashi no Kirai na Tantei


#4 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 09 julio 2017 - 03:12

DVDRIP - VF Cell Phone

Wise Registry Cleaner 8 24 539 + Portable
Jogos Xbox
Descarga peliculas PASSENGERS en espanol gratis


Angela Bettis

Tronok harca
Masters Of Sex



PSYCHO-PASS: The Movie2016

Talk-Show
- CODEX Игры для ПК Раздают: 11 Качают: 17 Размер: 10.75GB
Capitulo 1×06
Table 19 (2017)
Beastie Boys Video Anthology The Criterion Collect...(N) (P)


Г· (Deluxe)

Avengers: Infinity War
Big Little Lies


Power S04E01 HDTV x264-SVA[rarbg]

Life 2017 720p & 1080P HC HDRip X264 AC3-EVO ()
OpenLoad
Besetment (2017)
Zatch Bell
Resident Evil 5: Venganza (2012) [DVDRip...


#5 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 09 julio 2017 - 03:24

Torrent BALLERINA espanol

John Wick Chapter 2 (2017) MULTi VFF AC3 1080p HDL...(N) (A)
Подробнее
11 Set 2016


Preacher Season 2 Episode 1

The Handmaid's Tale
Ultimate Taste



iZombie 2017 2ВЄ temporada Completa [BluRay]

Jolly LLB 2 Torrent Movie Download Full 2017
Marudhu (2016) HD DVDRip


Glastonbury 2017 Katy Perry

Charlie Day
XIII – Die Verschworung
Pongo Il Cane Milionario DOWNLOAD ITA – 720p Bluray (2014)
Kenny vs. Spenny
The Killer Inside


Por Siempre Joan Sebastian Mexico-UnivisiГіn

Band of Brothers 2001 COMPLETE 1080p BluRay 10bit x265-HazMatt
(2017) DVDRip I Am Heath Ledger


#6 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 09 julio 2017 - 09:22

Crashing US

NCIS: Los Angeles 2x16
Group Sex The Movie XXX 720p WEBRip MP4-VSEX
Reckless
CINTA ABADI BENNY PANJAITAN


Free Episode Download

deep house
Yosuga no Sora
leer mas



2016 7.2 Vincent 2016 WEBDL 480P 458MB - by bliztcinema - 0 - In Comedy Drama France

Тайлер Пози
Sons of Anarchy


Frank Sinatra - A Voice 2 cds [Isohunt.to]

Glorious After Effects CS3 project
M.S Dhoni - The Untold Story (2016) DesiSCR Torrent
Read more...
Wayward Pines saison 1 episode 6
Born To Be Blue filmes online


Info: GENRE:В Crime| Drama| Mystery IMDB: 8.5/10 (TV Show) Star Cast: Benedict Cumberbatch, Martin Freeman, Una Stubbs

Older posts
Thor: Ragnarok English: Thor is imprisoned on the other side of the universe and finds himself in a race against time to get back to Asgard to stop Ragnarok, the destruction of his homeworld and the end of Asgardian civilization, at the hands of an all-powerful new threat, the ruthless Hela. Spanish: Thor esta encarcelado en el otro lado del universo y se encuentra en ...
Conduccion
Changeling
Episode 08 - Dead Fall


#7 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 09 julio 2017 - 09:28

DVDRIPVF Comme des bГЄtes

TWIN PEAKS 1? TEMPORADA TOrrent
City Hunter
Peaky Blinders
The RanchS02E07


estream HDRip/VF

Warming By The Devil S Fire Mp3
El protegido BluRay 1080p
Les Visiteurs 3: La Revolution 2016
Release Date
Saison 01 Episode 04



Asura: The City of Madness (2016)

Chappelle's Show
Empire 3. Sezon 18. Bolum
Download
Bosch sezonul 3 episodul 6
Meyer, Marissa Cinder


Kitty2016

Black Sails
The Birth of a Nation 2016 ver la pelicula completa en linea gratis


Pretty Little Liars

Detectorists
www TamilMV mx Half Girlfriend 2017 Hindi New DVDScr x264 ACC AVC 1 5GB Clear Audio mkv
Los Pitufos: La aldea escondida
Beauty.And.The.Beast.2017.720p.BRRip.x264.AAC-Ozlem


#8 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 09 julio 2017 - 09:38

Hannibal saison 3 Г©pisode 10

I Daniel Blake 2016 HC HDRip 600MB MkvCage mkv
Red Band Society 13


Blindspot saison 1 Г©pisode 6

HD Computer Killers
PC Purifier
Pirates of the Caribbean: Dead Men Tell No Tales (2017)



OnlyTease com_15 01 26 Caroline XXX IMAGESET-FuGLi[rarbg]

Следующая >
Watch iZombie Online
Stripperella


Tokyo Magnitude 8.0

Sons of Anarchy
Brick Mansions
Season 1 Episode 13 Can't Fix Crazy


Lets Be Cops 2014 720p BluRay 888MB

Great News (season 1, 2)
Born This Way
Hardshock Festival 2017 Recharge No 3


#9 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 20 julio 2017 - 05:40

WowPorn 17 07 14 Clover And Paula Shy Men Dont Exist XXX 1080p MP4-KTR[rarbg]

Aici se poate vedea rezultatele impodobirilor
La La Land (2016) English DVDScr 480p 400mb Download
THE CARRIE DIARIES
Valerian and the City of a Thousand Planets (2017) 720p BDRip x264 enlace de descarga gratuita
Die Industrielle-Revolutions-Show Twenty-Five Little Pre-pubers Without a Snoot-ful


Corey Yuen

Older posts
Download: DJ Khaled - I'm the One ft. Justin Bieber, Quavo, Chance the Rapper, Lil Wayne.mp3
bunyi burung buburak
Daimidaler: Prince vs. Penguin Empire
Dizi ile ilgili bolumu izlemek icin asag?daki partlar? kullanabilirsiniz veya konu alt?nda yer



Microsoft Flight Simulator 2004 CD

Animation
Swiss Army Man streaming Hank, un homme desespere errant dans la nature, decouvre un mysterieux cadavre. Ils vont tous les deux embarquer dans un voyage epique afin de retrouver leur foyer. Lorsque Hank realise que ce corps abandonne est la cle de sa survie, le suicidaire d'autrefois est force de convaincre un cadavre que la vie vaut la peine d'etre vecu.


Raised On It - Acoustic Mixtape

Aisha Balinda
Download
Pokemon: Origins


December 2016

Mozart in the Jungle
The Snow Queen
mkv
Revenge (season 1, 2, 3, 4)
AUTODESK AUTOCAD V2015 WIN64-ISO


#10 porsercok

porsercok

    Experto

  • Miembros
  • PipPipPipPip
  • 442 Mensajes:
  • LocationParis

Escrito 22 julio 2017 - 02:17

Versie: Pretty.Little.Liars.S04E09.HDTV.x264-LOL

E23 Day 21
Season 2 - Episode 22 s02e22


the great european c

How Food Works - The Facts Visually Explained (2017) (DK) Gooner
AuroraVid
The Real Housewives of New Jersey



Moana (Vajana) 2016

Miss Sloane
28. resz:
Wer kriegt die Verruckte? (1) Round One to the hot crazy Chick (1)
Jonathan Cherchi
Mentes Criminales 12x05


Nam Pueng Kom

Critical Role Season 7 Episode 17
Ultra Act Ultraman Leo
Schillerstra?e
Greatest Hits


Takeshi Kitano

A United Kingdom (2017)
Amiee Conn





0 usuarios están leyendo este tema

0 miembro/s, 0 invitado/s, 0 usuario/s anónimo/s