Showing posts with label Windows Server 2012 R2. Show all posts
Showing posts with label Windows Server 2012 R2. Show all posts

Sunday, February 25, 2024

[WSRV] Import private key into certificate file

 

openssl pkcs12 -export -out cert.pfx -inkey private.key -in cert.crt -certfile CACert.crt

Wednesday, October 16, 2019

[WSRV] Check Hyper-V Host



(get-item "HKLM:\SOFTWARE\Microsoft\VirtualMachine\Guest\Parameters").GetValue("HostName")

Monday, January 14, 2019

[WSRV] Search for file with a special character in the file name?



~="("

~="&"

~="hello you (1"

[WSRV] AVMA Keys


slmgr /ipk <AVMA_key>  



AVMA keys

The following AVMA keys can be used for Windows Server 2019.
EditionAVMA key
DatacenterH3RNG-8C32Q-Q8FRX-6TDXV-WMBMW
StandardTNK62-RXVTB-4P47B-2D623-4GF74
Essentials2CTP7-NHT64-BP62M-FV6GG-HFV28
The following AVMA keys can be used for Windows Server, version 1809.
EditionAVMA key
DatacenterH3RNG-8C32Q-Q8FRX-6TDXV-WMBMW
StandardTNK62-RXVTB-4P47B-2D623-4GF74
The following AVMA keys can be used for Windows Server, version 1803 and 1709.
EditionAVMA key
DatacenterTMJ3Y-NTRTM-FJYXT-T22BY-CWG3J
StandardC3RCX-M6NRP-6CXC9-TW2F2-4RHYD
The following AVMA keys can be used for Windows Server 2016.
EditionAVMA key
DatacenterTMJ3Y-NTRTM-FJYXT-T22BY-CWG3J
StandardC3RCX-M6NRP-6CXC9-TW2F2-4RHYD
EssentialsB4YNW-62DX9-W8V6M-82649-MHBKQ
The following AVMA keys can be used for Windows Server 2012 R2.
EditionAVMA key
DatacenterY4TGP-NPTV9-HTC2H-7MGQ3-DV4TW
StandardDBGBW-NPF86-BJVTX-K3WKJ-MTB6V
EssentialsK2XGM-NMBT3-2R6Q8-WF2FK-P36R2

Thursday, January 3, 2019

[WSRV] Powershell Cmdlets - Network



Test-NetConnection -ComputerName "Hostname or IP"

Test-NetConnection "Hostname" -Port #

Test-NetConnection "Hostname" -traceroute

Get-NetIPConfiguration

Resolve-DnsName -Name "Hostname"

Get-NetTCPConnection

Get-DnsClient
Set-DnsClientServer Address

Clear-DnsClientCache


Disable-NetAdapter -Name "Adapter Name"
Enable-NetAdapter -Name "Adapter Name"

Saturday, July 21, 2018

[WSRV] Exporting VM settings



$FormatEnumerationLimit = -1

cd $HOME\Desktop
mkdir VM

Get-VM | ft -autosize > $home\Desktop\VM\Get_VM_ft.txt
Get-VM | fl > $home\Desktop\VM\Get_VM_fl.txt
Get-VM | Get-VMCheckpoint | ft -autosize > $home\Desktop\VM\Get_VMCheckpoint_ft.txt
Get-VM | Get-VMsnapshot | ft -autosize > $home\Desktop\VM\Get_VMsnapshot_ft.txt
Get-VM | Get-VMHardDiskDrive | fl > $home\Desktop\VM\Get_VMHardDiskDrive_fl.txt
Get-VM | Get-VMHardDiskDrive | ft -autosize > $home\Desktop\VM\Get_VMHardDiskDrive_ft.txt
Get-VMHost > $home\Desktop\VM\Get_VMHost.txt
Get-VM | Get-VMIdeController | ft -AutoSize > $home\Desktop\VM\Get_VMIdeController_ft.txt
Get-VM | Get-VMIntegrationService | ft -AutoSize > $home\Desktop\VM\Get_VMIntegrationService_ft.txt
Get-VM | Get-VMIntegrationService | sort enabled | ft -AutoSize > $home\Desktop\VM\Get_VMIntegrationService_sort.txt
Get-VM |  Get-VMMemory | ft -AutoSize > $home\Desktop\VM\Get_VMMemory_ft.txt
Get-VM | Get-VMNetworkAdapter | ft -AutoSize > $home\Desktop\VM\Get_VMNetworkAdapter_ft.txt
Get-VM | Get-VMNetworkAdapter | fl > $home\Desktop\VM\Get_VMNetworkAdapter_fl.txt
Get-VMNetworkAdapterIsolation > $home\Desktop\VM\Get_VMNetworkAdapterIsolation.txt
Get-VMNetworkAdapterVlan > $home\Desktop\VM\Get_VMNetworkAdapterVlan.txt
Get-VMSystemSwitchExtension > $home\Desktop\VM\Get_VMSystemSwitchExtension.txt
Get-VMSwitch > $home\Desktop\VM\Get_VMSwitch.txt
Get-VMSwitch | fl > $home\Desktop\VM\Get_VMSwitch_fl.txt

Thursday, February 8, 2018

[WSRV] Remove Server GUI



uninstall-windowsfeature server-gui-shell, server-gui-mgmt-infra

Sunday, August 27, 2017

[WSRV] Script to Block .Net 4.7


$registryPath = "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\WU"
New-Item -Path $registryPath -Force | Out-Null
$Name = "BlockNetFramework47"
$value = "1"
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null

Saturday, August 5, 2017

Sunday, July 23, 2017

[EX2013] Deploy MaxConcurrentApi



# deploy MaxConcurrentApi key in multiple Exchange servers
Get-Exchangeserver | foreach{Invoke-Command -ComputerName $_.fqdn -ScriptBlock {
    $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"
    $Name = "MaxConcurrentApi"
    $value = "10"

    IF(!(Test-Path $registryPath)){
        New-Item -Path $registryPath -Force | Out-Null
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}
    ELSE {
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}

    restart-service netlogon -Force
}}

# deploy MaxConcurrentApi key in multiple DC servers. This is captured from the “currentDomainControllers” result.
(Get-Exchangeserver servername -Status).CurrentDomainControllers | foreach{Invoke-Command -ComputerName $_ -ScriptBlock {
    $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"
    $Name = "MaxConcurrentApi"
    $value = "10"

    IF(!(Test-Path $registryPath)){
        New-Item -Path $registryPath -Force | Out-Null
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}
    ELSE {
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}

    restart-service netlogon -Force
}}

Saturday, June 17, 2017

[WSRV] Temporarily block installation of the .NET




  • Back up the registry.
  • Start Registry Editor. To do this, click Start, type regedit in the Start Search box, and then press Enter.
  • Locate and click the following subkey:

    HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP
  • After you select this subkey, point to New on the Edit menu, and then click Key.
  • Type WU, and then press Enter.
  • Right-click WU, point to New, and then click DWORD Value.
  • Type BlockNetFramework47, and then press Enter.
  • Right-click BlockNetFramework47, and then click Modify.
  • In the Value data box, type 1, and then click OK.
  • On the File menu, click Exit to exit Registry Editor.
  • Tuesday, February 28, 2017

    [WSRV] Capture machine FQDN




    $fqdn = "$env:computername.$env:userdnsdomain"

    import-module activedirectory
    $name = hostname
    $domain = (Get-ADDomain).dnsroot
    $pc = ("$name"+"."+"$domain")
    $pc

    Sunday, December 18, 2016

    [WSRV] Prevent Truncation of Long Output

    Check with:


    $FormatEnumerationLimit


    Modify to unlimited:


    $FormatEnumerationLimit =-1

    Monday, October 17, 2016

    [WSRV] Backup AD partition



    ldifde -d "<configuration container>" -f configuration.ldf 

    Sunday, August 7, 2016

    [WSRV] Install .NET Framework 3.5 using Dism



    Using DISM with Internet connectivity


    For an online reference image that can access Windows Update


    DISM /Online /Enable-Feature /FeatureName:NetFx3 /All 
    



    Using DISM with no Internet connectivity


    DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:d:\sources\sxs
    

    [WSRV] Expand all values in object property


    Get-Mailbox mbx001 | Select-Object -ExpandProperty EmailAddresses

    https://blogs.msdn.microsoft.com/powershell/2009/09/13/select-expandproperty-propertyname/

    Saturday, July 9, 2016

    [WSRV] How to removing a pending update that is preventing a successful boot



    dism.exe /image:C:\ /cleanup-image /revertpendingactions


    remove the file C:\windows\winsxs\pending.xml.

    Monday, May 23, 2016

    Wednesday, March 2, 2016

    [WSRV] List Global Catalog Servers



    • nslookup
    • set type=srv
    • _gc._tcp.domain.local




    • nltest /dsgetdc:alabama.usa /gc




    • netdom query dc



    • Open Active Directory Sites and Services.
    • In the console tree, expand the Sites container, expand the site of the domain controller you want to check, expand the Servers container, and then expand the Server object.
    • Right-click the NTDS Settings object, and then click Properties.
    • On the General tab, if the Global Catalog box is selected, the domain controller is designated as a global catalog server.

    Tuesday, January 26, 2016

    [WSRV] Retrieve user details from Active Directory using SID


    $strSID="S-1-5-21-500000003-1000000000-1000000003-1001"
    $uSid = [ADSI]"LDAP://<SID=$strSID>"
    echo $uSid


    distinguishedName : {CN=John Doe,OU=Domain Admins,OU=People,OU=xxx,DC=xxx}
    Path              : LDAP://<SID=S-1-5-21-500000003-1000000000-1000000003-1001>