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

Home

partition 1

Details
Written by: po3dno
Category: MariaDB
Created: 07 October 2021
Hits: 1124

ALTER TABLE e_5136_copy
REORGANIZE PARTITION p_future INTO (
PARTITION p_202201 VALUES LESS THAN (TO_DAYS('2022-02-01 00:00:00')),
PARTITION p_future VALUES LESS THAN MAXVALUE);


ALTER TABLE e_5136
REORGANIZE PARTITION p_future INTO (
PARTITION p_202201 VALUES LESS THAN (TO_DAYS('2022-02-01 00:00:00')),
PARTITION p_202202 VALUES LESS THAN (TO_DAYS('2022-03-01 00:00:00')),
PARTITION p_202203 VALUES LESS THAN (TO_DAYS('2022-04-01 00:00:00')),
PARTITION p_202204 VALUES LESS THAN (TO_DAYS('2022-05-01 00:00:00')),
PARTITION p_202205 VALUES LESS THAN (TO_DAYS('2022-06-01 00:00:00')),
PARTITION p_202206 VALUES LESS THAN (TO_DAYS('2022-07-01 00:00:00')),
PARTITION p_202207 VALUES LESS THAN (TO_DAYS('2022-08-01 00:00:00')),
PARTITION p_202208 VALUES LESS THAN (TO_DAYS('2022-09-01 00:00:00')),
PARTITION p_202209 VALUES LESS THAN (TO_DAYS('2022-10-01 00:00:00')),
PARTITION p_202210 VALUES LESS THAN (TO_DAYS('2022-11-01 00:00:00')),
PARTITION p_202211 VALUES LESS THAN (TO_DAYS('2022-12-01 00:00:00')),
PARTITION p_202212 VALUES LESS THAN (TO_DAYS('2023-01-01 00:00:00')),
PARTITION p_future VALUES LESS THAN MAXVALUE);

secedit

Details
Written by: po3dno
Category: Power Shell
Created: 05 October 2021
Hits: 1121
$account = "accountName"
$userRight = "SeServiceLogonRight*"

$code = (Start-Process secedit -ArgumentList "/export /areas USER_RIGHTS /cfg c:\policies.inf" -Wait -PassThru).ExitCode
if ($code -eq 0)
    {
        Write-Output "security template exported successfully exit code $code"
    }
else
    {
        Write-Output "security template export failed exit code $code"
    }

$sid = ((Get-LocalUser $account).SID).Value

$policy = Get-Content C:\policies.inf
$newpol = @()
foreach ($line in $policy)
    {
        if ($line -like $userRight)
            {
                $line = $line + ",*$sid"
            }

        $newpol += $line
    }

$newpol | Out-File C:\policies.inf -Force

$code = (Start-Process secedit -ArgumentList "/configure /db secedit.sdb /cfg C:\policies.inf /areas USER_RIGHTS /log C:\policies.log" -Wait -PassThru).ExitCode
if ($code -eq 0)
    {
        Write-Output "exit code $code"
    }
else
    {
        Write-Output "exit code $code"
    }

Remove-Item -Path c:\policies.inf -Force

LocalGroup_AD

Details
Written by: po3dno
Category: C#
Created: 05 October 2021
Hits: 1153
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.DirectoryServices;
using System.Management;
using System.Threading;

namespace LocalGroup_AD
{
    class Program
    {
        static void Main(string[] args)
        {
            string r = null;
            using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"))
            {
                ManagementObjectCollection information = searcher.Get();
                if (information != null)
                {
                    foreach (ManagementObject obj in information)
                    {
                        r = obj["ProductType"].ToString();
                    }
                }

                Console.WriteLine("ProductType: {0}", r);
            }

            string osType = null;
            switch (r)
            {
                case "1":  osType = "WKS"; break;
                case "3":  osType = "SRV"; break;
                default:
                    Console.WriteLine("No valid input for osType");
                    Environment.Exit(0);
                    break;
            }

            //Console.ReadKey();
            //Environment.Exit(0);

            if (args.Count() != 1)
            {
                Console.WriteLine("Usage: LocalGroup_AD.exe [adm|rdu]");
                Environment.Exit(0);
            }

            string PC = System.Environment.MachineName;
            string sid = null;

            string lGroup = null;
            string groupName = null;
            switch (args[0].ToLower())
            {
                case "adm": lGroup = "Administrators"; groupName = "local_administrator_" + PC; sid = "544";  break;
                case "rdu": lGroup = "RDU"; groupName = "local_rdu_" + PC; sid = "555";  break;
                default: 
                    Console.WriteLine("No valid input for groupName");  
                    Environment.Exit(0); 
                    break;
            }

            DirectoryEntry dom = new DirectoryEntry();

            string pathDN = "OU=" + lGroup + ",OU=" + osType + ",OU=LocalGroups,OU=Security Groups";

            Console.WriteLine(pathDN);
            DirectoryEntry ou = dom.Children.Find(pathDN);

            bool groupName_exist = false;
            try
            {
                DirectoryEntry childGroup = ou.Children.Find("CN=" + groupName);
                if (childGroup != null)
                    groupName_exist = true;
            }
            catch { }

            if (groupName_exist)
            {
                Console.WriteLine("Group {0} exist", groupName);
            }
            else
            {
                try
                {
                    DirectoryEntry group = ou.Children.Add("CN=" + groupName, "group");
                    group.Properties["samAccountName"].Value = groupName;


                    group.CommitChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine("Try add group to domain..." + Environment.NewLine + e.ToString());
                }
            }




            ManagementObjectSearcher searchGroup = new ManagementObjectSearcher(@"SELECT name FROM Win32_Group where LocalAccount = true and sid = 'S-1-5-32-"+ sid +"'");
            ManagementObjectCollection adminGroup = searchGroup.Get();
            string gr = null;

            foreach (ManagementObject group in adminGroup)
            {
                gr = group["Name"].ToString();
                Console.WriteLine(group["Name"].ToString());
                continue;
            }

            Thread.Sleep(10000);

            DirectoryEntry localGroup = new DirectoryEntry(String.Format("WinNT://{0}/{1},group", Environment.MachineName, gr));
            DirectoryEntry remoteGroup = new DirectoryEntry(String.Format("WinNT://{0}/{1}", Domain, groupName));
            try
            {
                localGroup.Invoke("Add", new object[] { remoteGroup.Path });
                localGroup.CommitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine("Try add group to local group..." + Environment.NewLine + e.ToString());
            }

        }
    }
}

LDAP

Details
Written by: po3dno
Category: Windows
Created: 30 September 2021
Hits: 1119

Условия LDAP

Фильтр определяет необходимые условия  для  включения объекта в результат запроса. LDAP-фильтр может содержать одно или более условий. 
Результат условия - "Истина" или "Ложь". Общий вид фильтра

(<Атрибут AD><оператор сравнения><значение>)

<Атрибут AD> - LDAP-имя атрибута AD. Операторы сравнения

Оператор Значение
= Равенство
>= Больше или равно
<= Меньше или равно

Read more …

iso uefi

Details
Written by: po3dno
Category: Power Shell
Created: 05 July 2021
Hits: 1235

Mount-WindowsImage -Path .\iso -ImagePath 'C:\VMs\w2012r2_en\Virtual Hard Disks\w2012r2_en.vhdx' -Index 1

New-WindowsImage -CapturePath .\iso -Name "Windows 2012R2 2111" -ImagePath C:\winpe_x64\install.wim -Description "Windows 2012R2 2111" -Verify

Dismount-WindowsImage -Path .\iso\ -Discard

unpack iso

replace install.wim

.\oscdimg.exe -m -o -u2 -udfver102 -bootdata:2#p0,e,bC:\winpe_x64\ISO\boot\etfsboot.com#pEF,e,bC:\winpe_x64\ISO\efi\microsoft\boot\efisys.bin c:\winpe_x64\ISO D:\VM\ISO\SW_DVD9_Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_Russian_-4_MLF_X19-82917_2111.iso

  1. How to stop computer from entering sleep under “Critical Battery Trigger Met” misidentification
  2. Mailbox permission export in excel
  3. MariaDB partition
  4. Automatic Partition Maintenance in MariaDB

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

Docker Article Count:  3

pg Article Count:  2

Page 11 of 32

  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

Login Form

  • Forgot your password?
  • Forgot your username?

Statistics

  • Users 2
  • Articles 177
  • Articles View Hits 173494