• Home
  • PS
  • C#
  • Perl
  • MSSQL
  • MariaDB
  • Linux
  • Docker
  • MacOS
  • PG
  • Exchange Server
  • Windows
  • Other

Home

DHCP Policy

Details
Written by: po3dno
Category: Power Shell
Created: 24 May 2016
Hits: 1026

# получить список mac

[System.Collections.ArrayList]$d = (Get-DhcpServerv4Policy -ScopeId 172.16.36.0 -name "Mac allow").MacAddress

 

# удалить MAC

$d.Remove("24-e3-14-82-6c-86")

 

# добавить EQ

$res = ($d | ?{$_ -ne "EQ"} | sort) -join ",EQ," -replace '^(.*)','EQ,$1' -split ","

 

# сохранить политику

Set-DhcpServerv4Policy -ScopeId 172.16.36.0 -Name "Mac allow" -MacAddress $res

Add user to local group

Details
Written by: po3dno
Category: Power Shell
Created: 28 April 2016
Hits: 985

$user = [ADSI]"WinNT://domain/username,user"

$AdminGroup = [ADSI]"WinNT://$host/Пользователи удаленного рабочего стола,group";

$AdminGroup.Add($user.Path)

Unlock local account

Details
Written by: po3dno
Category: Power Shell
Created: 28 April 2016
Hits: 973

$ObjUser = [ADSI]"WinNT://$computer/$user" 
$ObjUser.IsAccountLocked = $false

Powershell SSL Certificate

Details
Written by: po3dno
Category: Power Shell
Created: 26 April 2016
Hits: 1035
PS C:\> $def = @"
public class ClientCertWebClient : System.Net.WebClient
{
    System.Net.HttpWebRequest request = null;
    System.Security.Cryptography.X509Certificates.X509CertificateCollection certificates = null;

     protected override System.Net.WebRequest GetWebRequest(System.Uri address)
     {
         request = (System.Net.HttpWebRequest)base.GetWebRequest(address);
         if (certificates != null)
         {
             request.ClientCertificates.AddRange(certificates);
         }
         return request;
     }

     public void AddCerts(System.Security.Cryptography.X509Certificates.X509Certificate[] certs)
     {
         if (certificates == null)
         {
             certificates = new System.Security.Cryptography.X509Certificates.X509CertificateCollection();
         }
         if (request != null)
         {
             request.ClientCertificates.AddRange(certs);
         }
         certificates.AddRange(certs);
     }
 }
 "@

PS C:\> Add-Type -TypeDefinition $def

S C:\> $wc = New-Object ClientCertWebClient
PS C:\> $certs = dir cert:\CurrentUser\My
PS C:\> $wc.AddCerts($certs)
PS C:\> $wc.DownloadString("http://stackoverflow.com")

Exchange 2013/2016 обновление

Details
Written by: po3dno
Category: Exchange Server
Created: 18 April 2016
Hits: 1060

Set-ServerComponentState srv1 –Component HubTransport –State Draining –Requester Maintenance

Redirect-Message -Server srv1 -Target srv2.domain.local -Confirm:$false

Suspend-ClusterNode –Name srv1

Set-MailboxServer srv1 –DatabaseCopyActivationDisabledAndMoveNow $true

Set-ServerComponentState srv1 -Component ServerWideOffline –State InActive –Requester Maintenance

 

setup.exe /prepareschema /IAcceptExchangeServerLicenseTerms

setup.exe /preparead /IAcceptExchangeServerLicenseTerms

setup.exe /PrepareDomain /IAcceptExchangeServerLicenseTerms

setup.exe /m:upgrade /IAcceptExchangeServerLicenseTerms

 

Resume-ClusterNode –Name srv1

Set-MailboxServer srv1 –DatabaseCopyAutoActivationPolicy Unrestricted

Set-MailboxServer srv1 –DatabaseCopyActivationDisabledAndMoveNow $false

Set-ServerComponentState srv1 –Component HubTransport –State Active –Requester Maintenance

Set-ServerComponentState srv1 -Component ServerWideOffline –State Active –Requester Maintenance

cd "C:\Program Files\Microsoft\Exchange Server\V15\scripts"

.\RedistributeActiveDatabases.ps1 –DagName DAG1 –BalanceDbsByActivationPreference –confirm: $false 

  1. процессы и их блокировки в SQL
  2. dump process in Windows Server 2008
  3. Wsus target by network
  4. Exchange photo

Subcategories

Power Shell Article Count:  53

C# Article Count:  10

Perl Article Count:  1

Exchange Server Article Count:  15

Other Article Count:  24

MSSQL Article Count:  17

Windows Article Count:  25

MariaDB Article Count:  3

Linux Article Count:  7

Docker Article Count:  2

pg Article Count:  1

Page 20 of 32

  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

Login Form

  • Forgot your password?
  • Forgot your username?

Statistics

  • Users 2
  • Articles 164
  • Articles View Hits 149075