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

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: 972

$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")

dump process in Windows Server 2008

Details
Written by: po3dno
Category: Power Shell
Created: 10 February 2016
Hits: 1157
  • Launch PowerShell and dot source function from the Out-Minidump.ps1 (note first dot):

. c:\path\to\Out-Minidump.ps1
  • Now you can actually create dump of the process using this syntax:
Get-Process 'notepad.exe' | Out-Minidump -DumpFilePath C:\temp
  • To get help, run this command:
Get-Help Out-Minidump -Full

Read more …

Wsus target by network

Details
Written by: po3dno
Category: Power Shell
Created: 16 December 2015
Hits: 965

[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")

$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer("localhost",$False)

$groupall = $wsus.GetComputerTargetGroups()

$pcall = $groupall | %{$_.GetComputerTargets()}

Read more …

  1. Port WWN
  2. Обновление поля "Руководитель" в AD
  3. Инвентаризация
  4. Windows shell commands to get system/process info

Page 5 of 11

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

Login Form

  • Forgot your password?
  • Forgot your username?

Statistics

  • Users 2
  • Articles 164
  • Articles View Hits 149004