CSV файл:

GivenName,Surname,Name,SamAccountNAme,UserPrincipalName,Department,Path,Enabled,Password,PasswordNeverExpires
User,Test1,UserTest1,UserTest1,UserTest1@domain.exonix.ru,IT,"OU=Test,DC=DOMAIN,DC=EXONIX,DC=RU",$True,P@ssw0rd,$True

Import-Csv C:\Users\user\Desktop\users.csv | % {New-ADUser -GivenName $_.GivenName -Surname $_.Surname -Name $_.Name -SamAccountName $_.SamAccountName -UserPrincipalName $_.UserPrincipalName -Department $_.Department -Path $_.Path -Enabled $True -AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force) -PasswordNeverExpires $True}

 Аудит входа по RDP:

Get-WinEvent -FilterHashtable @{Logname="Security";starttime="2017-05-31";id=4624} | where {$_.Properties[17].Value -eq "C:\Windows\System32\winlogon.exe"} | Foreach {$_.TimeCreated,$_.Properties[5].Value,$_.Properties[18].Value}
Add-KdsRootKey –EffectiveImmediately
New-ADServiceAccount –Name TestSQLMSA -RestrictToSingleComputer
Add-ADComputerServiceAccount -Identity SCCM1 -ServiceAccount TestSQLMSA

Install-ADServiceAccount TestSQLMSA

 Запрос сертификта в CA и его установка в Windows Server 2016 Core:

Set-Location 'Cert:\LocalMachine\My'
Get-Certificate -Template SSTP-VPN -Url ldap:///CN=dc1.domain.com -DnsName VPN4.DOMAIN.COM -CertStoreLocation Cert:\LocalMachine\My

 Чтение лога в реальном времени по фильтру содержимого:

Get-Content C:\Windows\System32\LogFiles\Firewall\pfirewall.log -Tail 50 -wait | select-string "3389"

Zabbix + Firewall:

Get-Content .\zabbix_agentd.log -Tail 10 –Wait
New-NetFirewallRule -DisplayName 'Zabbix Ports' -Profile @('Domain', 'Private') -Direction Inbound -Action Allow -Protocol TCP -LocalPort @('10050', '10051')
Set-NetFirewallProfile -All -LogAllowed:true -LogBlocked:true
$Server = get-adgroupmember -Identity "zabbix agent"
Foreach ($i in $Server) {
xcopy /S "\\ber-wsrv2\BERLIN\scripts\zabbix_agent\bin\win64\*" "\\$($i.name)\C$\zabbix\"
Invoke-Command -ComputerName $i.name -ScriptBlock {
cd C:\zabbix
$FQDN=(Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain

(Get-Content zabbix_agentd.win.conf) | ForEach-Object { $_ -replace "Hostname=Windows host", "Hostname=$FQDN" } | Set-Content zabbix_agentd.win.conf
#(Get-Content zabbix_agentd.win.conf) | ForEach-Object { $_ -replace "zabbix_agentd.log", "zabbix\zabbix_agentd.log" } | Set-Content zabbix_agentd.win.conf
#(Get-Content zabbix_agentd.win.conf) | ForEach-Object { $_ -replace "Server=127.0.0.1", "Server=10.254.1.100" } | Set-Content zabbix_agentd.win.conf
#(Get-Content zabbix_agentd.win.conf) | ForEach-Object { $_ -replace "ServerActive=127.0.0.1", "ServerActive=10.254.1.100" } | Set-Content zabbix_agentd.win.conf

.\zabbix_agentd.exe --config zabbix_agentd.win.conf --install
.\zabbix_agentd.exe --config zabbix_agentd.win.conf --start
}
}