Report Permessi Share e Appartenenza Gruppi

Salvare il codice in un file di testo con nome ReportPermessiShareAppartenenzaGruppi.ps1
Eseguire Powershell con diritti di amministrazione sulla share
cd [path cartella contenente ReportPermessiShareAppartenenzaGruppi.ps1]

# Powershell.exe -executionpolicy bypass .\ReportPermessiShareAppartenenzaGruppi.ps1

Codice:

Get-Item \\DFS\share\department | select -ExpandProperty FullName | % {write "Folder: $_ `n"; get-acl $_ | select -property AccessToString | FL ; $($(get-acl $_ | select -ExpandProperty Access | where IdentityReference -Match "Domain01*|Domain02*" | select -ExpandProperty IdentityReference) -replace "^(.*?\\)(.+)" , '$2') | % {Get-ADGroup -Filter {( name -like $_) -and (ObjectClass -eq "group") -and ( name -notlike "Domain Admins") -and ( name -notlike "Administrators") } -server "domainController.domain.ext" -searchbase "DC=Domain01,DC=domain,DC=ext" -Properties * | % { write "`nGroup" $_.CN "`nMember" ; Get-ADGroupMember $_ | select -ExpandProperty SamAccountName }} ; write "`n`n`n --------------------------------------------------------------------------------------------------------------------------------------------- `n`n`n"} | Out-File -FilePath $(".\Output"+$(Get-Date -UFormat %Y-%m-%d_%H.%M.%S)+".txt") -Encoding "UTF8" -Append -Force

Get-ChildItem \\DFS\share\department | select -ExpandProperty FullName | % {write "Folder: $_ `n"; get-acl $_ | select -property AccessToString | FL ; $($(get-acl $_ | select -ExpandProperty Access | where IdentityReference -Match "Domain01*|Domain02*" | select -ExpandProperty IdentityReference) -replace "^(.*?\\)(.+)" , '$2') | % {Get-ADGroup -Filter {( name -like $_) -and (ObjectClass -eq "group") -and ( name -notlike "Domain Admins") -and ( name -notlike "Administrators") } -server "domainController.domain.ext" -searchbase "DC=Domain01,DC=domain,DC=ext" -Properties * | % { write "`nGroup" $_.CN "`nMember" ; Get-ADGroupMember $_ | select -ExpandProperty SamAccountName}} ; write "`n`n`n --------------------------------------------------------------------------------------------------------------------------------------------- `n`n`n"} | Out-File -FilePath $(".\Output"+$(Get-Date -UFormat %Y-%m-%d_%H.%M.%S)+".txt") -Encoding "UTF8" -Append -Force

# shere folder access group departmentGroup read and execute this folder only on shere folder departement

Get-ADGroup -Filter {name -like "departmentGroup"} -server "domainController.domain.ext" -searchbase "DC=Domain01,DC=domain,DC=ext" -Properties * | % { write "`nGroup" $_.CN "`nMember" ; Get-ADGroupMember $_ | select -ExpandProperty SamAccountName} | % {Get-ADGroup -Filter {( name -like $_) -and (ObjectClass -eq "group") -and ( name -notlike "Domain Admins") -and ( name -notlike "Administrators") } -server "domainController.domain.ext" -searchbase "DC=Domain01,DC=domain,DC=ext" -Properties * | % { write "`nGroup" $_.CN "`nMember" ; Get-ADGroupMember $_ | select -ExpandProperty SamAccountName} ; write "`n --------------------------------------------------------------------------------------------------------------------------------------------- `n"} | Out-File -FilePath $(".\Output"+$(Get-Date -UFormat %Y-%m-%d_%H.%M.%S)+".txt") -Encoding "UTF8" -Append -Force

Nessun interprete di script per file con estensione .vbs

link: http://gioxx.org/2015/04/22/nessun-interprete-di-script-per-file-con-estensione-vbs-risolvere-il-problema/

Aggiungre il codice che segue in un file .reg ed eseguirlo


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.VBS]
@=”VBSFile”
[HKEY_CLASSES_ROOT\VBSFile]
@=”VBScript File”
“EditFlags”=hex:00,00,00,00
[HKEY_CLASSES_ROOT\VBSFile\Shell]
@=”Edit”
[HKEY_CLASSES_ROOT\VBSFile\Shell\Edit]
@=”&Edit”
[HKEY_CLASSES_ROOT\VBSFile\Shell\Edit\Command]
@=”Notepad.exe %1″

[HKEY_CLASSES_ROOT\.VBE]
@=”VBEFile”
[HKEY_CLASSES_ROOT\VBEFile]
@=”VBScript Encoded File”
“EditFlags”=hex:00,00,00,00
[HKEY_CLASSES_ROOT\VBEFile\Shell]
@=”Edit”
[HKEY_CLASSES_ROOT\VBEFile\Shell\Edit]
@=”&Edit”
[HKEY_CLASSES_ROOT\VBEFile\Shell\Edit\Command]
@=”Notepad.exe %1″

Il sorriso più bello

Quando sorridi abbagli i neon e tutto brilla del tuo splendore.
Il tuo sorriso mi riempie gli occhi e mi scalda il cuore e qualsiasi giornata è subito bella.
Quando al buon anno sorridendo a bocca piena ti sei scusata per il boccone, avrei dovuto dirti che non servivano scuse, perché non c’è niente che possa rovinare il tuo sorriso, che è quanto di più bello ci sia e anche se non ti conosco passerei volentieri la vita a renderti felice per veder sbocciare sempre la luce dalle tue labbra.
Questo è il mio fiore per te, Buon SanValentio.
A me, lo sai, basta un tuo sorriso, il Fiore più Bello.

Un Altro Sugo Sbagliato

250-280 grammi macinato bovino mediamente grasso
1 carota
1 costa di sedano
2 scalogni
prezzemolo
Origano
piccola bottiglia da 400g di passata pomodoro con basilico
evo
sale di mamma
sale

Triturare sedano scalogni e carota con un cucchiaino colmo sale di mamma, mettere in pentola con la carne e 2 dita d’acqua di un bicchiere e far cuocere a fuoco bassissimo dopo aver portato velocemente tutto a ebollizione con coperchio per circa 25 minuti, poi aggiungere il pomodoro, riempire per metà la bottiglia di passata vuota con acqua oligominerale, chiudere il tappo, agitare la bottiglia per sciacquare il pomodoro e buttare in pentola aggiungere un cucchiaino raso di origano e mescolare. Riportare velocemente ad ebollizione e far cuocere per 45 – 60 minuti. A parte preparare con mini-pimer una crema di prezzemolo, un pugno abbondante di prezzemolo 3 cucchiai d’evo un pizzico di sale 2 dita d’acqua di un bicchiere d’acqua.

1kg Mezzi Paccheri Rummo cotti in abbondante bollente acqua salata, quando iniziano ad aprirsi i bordi rotondi scolarli e condire prima col sugo poi aggiungere la crema di prezzemolo e rcondirli di nuovo servire con parmigiano reggiano a piacere.

Cancellazione Cartelle Windows

Utile utilizzare un piccolo script che utilizzi Robocopy in modalità Mirror Backup (/MIR /B)

RoboERASE.cmd

:: Destinazione: cartella da cancellare
set Cartella="%SystemDrive%\folder\elce\New folder"

:: Sorgente: cartella vuota
set Hole=”%SystemDrive%\folder\elce\Hole”

:: log RoboCopy
set log=”%SystemDrive%\folder\elce\OUTPUT-RoboErase.log”

:: Cancellazione Contenuto Cartella Destinazione MIRROR cartella vuota
robocopy %Hole% %Cartella% /MIR /xj /np /W:0 /R:2 /B /Log+:%log%

Questo codice per essere lanciato in modalità SYSTEM va eseguito tramite psexec.

Eseguire Come Amministratore lo script roboERASE-SYSTEM.cmd

cmd /c %SystemDrive%\PsExecFolder\psexec.exe -i -s %SystemDrive%\folder\elce\roboERASE.cmd

PowerShell Caratteri Speciali – Special Characters And Tokens

Site
 

$ (dollar sign)

Declare/use a variable
Example.
$abc = "123"
 

$_ (dollar underscore)

‘THIS’ token. Typically refers to the item inside a foreach loop.
Task: Print all items in a collection.
Solution.
... | foreach { Write-Host $_ }
 

$$ (double dollar, two dollars)

Last token of last command. Does NOT refer to the whole command.
Example.
Write-Host "Hello, world!"
$$

Output.
Hello, world!
Hello, world!
 

$^ (dollar sign + caret)

Thanks to Richard for accidentally finding this one.
First token of last command. Does NOT refer to the whole command.
Example.
Write-Host "Hello, world!"
$^

Output.
Hello, world!
Write-Host
 

$? (dollar sign + question mark)

Many google searches were looking for this information, so I experimentally found what it does.
Returns True or False value indicating whether previous command ended with an error. For some reason it does not catch all errors, but most of the time it works.
Task 1: See if a powershell cmdlet exists in the system.
Code.
SomeCmdLet #does not exists
$?
$?

Output.
The term ‘SomeCmdLet’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:15
+ SomeCmdLet <<<< #does not exists
+ CategoryInfo : ObjectNotFound: (SomeCmdLet:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
False #error occured – previous cmdlet (SomeCmdLet) was not found
True #no errors returned by the previous command ($?)

Task 2: See if a WMI class exists in the system
Code.
gwmi win32_processo -ErrorAction SilentlyContinue #intentional error, win32_processor is the right one
$?
$?

Output.
False
True
 

$() (dollar sign + round brackets)

Thanks to Kevin for a suggestion to add this one.
Sub-expression operator for double-quoted strings. Whatever is in the brackets should be evaluated first.
Example.
$name = "Kevin";
"Hello, $name, there are $($name.length) characters in your name"

Output.
Hello, Kevin, there are 5 characters in your name

It can be used with any expression, so this will also work:
“There are $(2+3) characters in your name”
 

${} (dollar sign + curly brackets)

Thanks to Remco for a hint about it.
Declare or use a variable with non-standard characters in it, a more generalized syntax to $variableName. It adds support for punctuation or non-English characters.
References: StackOverflow, Technet, ss64.com.
Example.
${,,,} = 5
${,,,}

Output.
5
 

| (pipeline)

Catch output of the command and pass it to another command.
Task: Get list of processes and select top 3 items.
Solution.
Get-Process | Select-Object -first 3
 

% (percentage)

1. Shortcut to foreach.
Task: Print all items in a collection.
Solution.
... | % { Write-Host $_ }

2. Same as Mod in VB.
Example:
5 % 2
 

.. (double dot)

Specify a range.
Task: Print numbers 1 through 5 without a foreach loop.
Code.
1..5
Output.
1
2
3
4
5
 

:: (double-colon)

Thanks to Darrell for asking about this one.
Reference static member of a class. The class name must be enclosed in square brackets.
Task: Compare two strings.
Code.
[string]::Equals("a", "b")
Output.
False
 

+ (plus sign)

Thanks to Cody for pointing at this feature of Powershell.
Aside from its natural use, i.e. addition of two arguments, you can also use a plus sign to reference a public nested class.
For official reference, see here. Thanks to David Brabant for help in figuring this out.
Code.
[System.Net.WebRequestMethods+Ftp]::UploadFile
Output.
STOR
 

+= (plus equals)

Thanks to Brian G.
Increments value on the left by the amount on the right (and stores result). For strings it means concatenation.
Very well known to C# developers, so not strictly a Powershell feature.
In Powershell, however, this operator has a special use – you can add elements to arrays.
Mostly syntactic sugar, the array is still recreated behind the scenes, so just to save a few characters.
Code.
$b = 1 #initialize a variable
$b += 2 #add 2
$b #output 3 (1 + 2)

$a = @(1,2,3) #initialize array with 3 elements
$a += 4 #add element number 4
$a #output 4 elements
Output.
3

1
2
3
4
 

! (exclamation mark)

Thanks to Leo for asking about this one.
Shortcut to -not.
Code.
$a = $null;
if(!$a) { Write-Host '$a is null' }

Output.
$a is null
 

? (question mark)

Output all items that conform with condition (shortcut to where). Shortcut to the following:
foreach { if (…) {return … } }
Task: Print all odd numbers between 1 and 5 (inclusive):
Code.
1..5 | ? { $_ % 2 }
Output.
1
3
5
 

` (backtick)

1. Continue command on the next line.
Code.
Write-Host `
"Hello, world!"

Output.
Hello, world!

2. Include a special symbol into a string. Available options:
`$ – include a dollar symbol in your string. If you don’t escape it, Powershell will assume you are trying to embed a variable.
`0 – Null. My preference is using $null instead.
`a – Alert. Yes, it does make sound, and you can use multiple for multiple beeps.
`b – Backspace
`f – form feed – only affects printed documents.
`n – New line
`r – Carriage return
`t – Horizontal tab
`v – Vertical tab – only affects printed documents.
`’ – Single quote – I prefer using double quotes when I need to escape a single one, since I don’t need any escaping in this case.
`” – Double quote – you can use single quotes, and you don’t need this symbol. My preference is use standard escaping instead, so 4 double quotes (“”””) means a double quote.
Official article by Microsoft with full description on every token: http://technet.microsoft.com/en-us/library/hh847835.aspx
 

# (hash sign)

Single line comment.
Example.
#This is a commented line
#This is a second one

 

<# … #> (left angle bracket / &lt + pound … pound + right angle bracket / &gt)

Block/Multi-line comment.
Example.
<#This is a commented block#>
 

& (ampersand)

Execute string as command.
Example.
& "Get-Process"
 

@( ) (email-at + round brackets)

Declare arrays.
Note: comma is used as a separator, in contrast to hash table declaration.
Example.
$a = @("One", "Two", "Three")
 

@{ } (email-at + curly brackets/braces)

Declare hash tables.
Note: semicolon is used as a separator, in contrast to array declaration.
Example.
$a = @{"1" = "one"; "2" = "two"; "3" = "three"}
 

@’ … ‘@ (email-at + single quote … single quote + email-at)

Here-string without embedded variables.
Code.
@'
$(1+2)
$(3+4)
$(5+6)
'@

Output.
$(1+2)
$(3+4)
$(5+6)
 

@” … “@ (email-at + double quote … double quote + email-at)

Here-string with embedded variables or other code bloc from other language like C# C++.
Code.
@"
$(1+2)
$(3+4)
$(5+6)
"@

Output.
3
7
11

SID Microsoft Predefiniti

SID Values For Default Windows NT Installations

SUMMARY
Many User Accounts, Local Groups, and Global Groups have a default Security Identifier (SID) or Relative Identifier (RID) value across all installations of Windows NT. These values can be displayed by using the utility Getsid.exe from the Windows NT Resource Kit.

MORE INFORMATION
The following information was taken from a Domain Controller named DomainName. The default groups differ on a Windows NT Workstation or Server installation, and if they are not a member of a domain, then the computer name would be considered the authority.

The values below that have a full SID value will differ on all installations, but the RID value at the end of the SID is the same across all installations.

NOTE: The values in parentheses is the hexadecimal values of the RID.
Built-In Users

DOMAINNAME\ADMINISTRATOR
S-1-5-21-917267712-1342860078-1792151419-500 (=0x1F4)

DOMAINNAME\GUEST
S-1-5-21-917267712-1342860078-1792151419-501 (=0x1F5)

Built-In Global Groups

DOMAINNAME\DOMAIN ADMINS
S-1-5-21-917267712-1342860078-1792151419-512 (=0x200)

DOMAINNAME\DOMAIN USERS
S-1-5-21-917267712-1342860078-1792151419-513 (=0x201)

DOMAINNAME\DOMAIN GUESTS
S-1-5-21-917267712-1342860078-1792151419-514 (=0x202)

Built-In Local Groups

BUILTIN\ADMINISTRATORS S-1-5-32-544 (=0x220)
BUILTIN\USERS S-1-5-32-545 (=0x221)
BUILTIN\GUESTS S-1-5-32-546 (=0x222)
BUILTIN\ACCOUNT OPERATORS S-1-5-32-548 (=0x224)
BUILTIN\SERVER OPERATORS S-1-5-32-549 (=0x225)
BUILTIN\PRINT OPERATORS S-1-5-32-550 (=0x226)
BUILTIN\BACKUP OPERATORS S-1-5-32-551 (=0x227)
BUILTIN\REPLICATOR S-1-5-32-552 (=0x228)

Special Groups

\CREATOR OWNER S-1-3-0
\EVERYONE S-1-1-0
NT AUTHORITY\NETWORK S-1-5-2
NT AUTHORITY\INTERACTIVE S-1-5-4
NT AUTHORITY\SYSTEM S-1-5-18
NT AUTHORITY\authenticated users S-1-5-11 *
NT AUTHORITY\LOCAL SERVICE S-1-5-19
NT AUTHORITY\NETWORK SERVICE S-1-5-20

* For Windows NT 4.0 Service Pack 3 and later only
Back to the topBack to the top | Give Feedback

Properties
Article ID: 163846 – Last Review: November 1, 2006 – Revision: 2.1
APPLIES TO

Microsoft Windows NT Workstation 3.5
Microsoft Windows NT Workstation 3.51
Microsoft Windows NT Workstation 4.0 Developer Edition
Microsoft Windows NT Server 3.5
Microsoft Windows NT Server 3.51
Microsoft Windows NT Server 4.0 Standard Edition

Keywords:
kbinfo kbnetwork KB163846