- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 362
Get replication partner status | |
repadmin /showrepl | Get-ADReplicationPartnerMetadata |
Get Inbound replication queue details | |
repadmin /queue | Get-ADReplicationQueueOperation |
Replicate specific AD objects between domain controllers | |
repadmin /replsingleobj | Sync-ADObject |
Get replication metadata of an AD object | |
repadmin /showobjmeta | Get-ADReplicationAttributeMetadata |
Shows highest committed USN | |
repadmin /showutdvec | Get-ADReplicationUpToDatenessVectorTable |
Displays ISTG details | |
repadmin /istg * | Get-ADReplicationSite –filter * | Select InterSiteTopologyGenerator |
List all the subnets in the forest | |
dsquery subnet | Get-ADReplicationSubnet |
List the AD sites in the domain | |
dsquery site | Get-ADReplicationSite |
Get-ADReplicationPartnerMetadata -Target $env:computername |Select Server,@{n="Partner";e={(Resolve-DnsName $_.PartnerAddress).NameHost}},LastReplicationAttempt,LastReplicationResult, LastReplicationSuccess
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 824
$vhd = Get-ChildItem -Filter base* | Get-VHD
$curdisk = "e:\export\virtual hard disks\base-w2019en.vhdx";
function Get-ParentAVHDX {
param ($p);
$pp = $vhd | ?{$_.parentpath -eq $p};
if ($pp) {
Get-ParentAVHDX($pp.path);
write-host $pp.path $pp.parentpath;
Merge-VHD -Path $pp.Path -DestinationPath $pp.ParentPath -Verbose -WhatIf
}
}
Get-ParentAVHDX($curdisk)
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 825
$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
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 938
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