Showing posts with label XADM. Show all posts
Showing posts with label XADM. Show all posts

Wednesday, May 15, 2024

[WSRV] Powershell History from other sessions

 


(Get-PSReadlineOption).HistorySavePath

or


Get-Content (Get-PSReadlineOption).HistorySavePath | more


or 


notepad (Get-PSReadlineOption).HistorySavePath

Monday, January 14, 2019

[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

Monday, August 6, 2018

[EX10] Check Send-As Permissions



Finding all users who have Send-As :

Get-Mailbox -Resultsize Unlimited | Get-ADPermission | ? {($_.ExtendedRights -like "*send-as*") -and -not
($_.User -like "nt authorityself")} | ft Identity, User -auto

Find out who a particular user can Send-As:

Get-Mailbox -Resultsize Unlimited | Get-ADPermission | ? {($_.ExtendedRights -like "*send-as*") -and -not
($_.User -like "nt authorityself") -and ($_.User -like "DOMAINUsernameUwantToFind")} | ft Identity, User -auto

Find all users who have Full Access to the mailbox of others:

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | ? {($_.AccessRights -match "FullAccess") -and 
not ($_.User -like "NT AUTHORITYSELF")} | ft Identity, User

Add Full Access without Auto-Mapping:

Add-MailboxPermission -Identity JeroenC -User 'Mark Steele' -AccessRight FullAccess -InheritanceType All -Automapping $false


"This example removes auto-mapping on an existing shared mailbox and removes the auto-mapping behavior for users who have already been granted Full Access permissions."

$FixAutoMapping = Get-MailboxPermission sharedmailbox |where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false}
$FixAutoMapping | Remove-MailboxPermission
$FixAutoMapping | ForEach {Add-MailboxPermission -Identity $_.Identity -User $_.User -AccessRights:FullAccess -AutoMapping $false}

Wednesday, January 31, 2018

[EX2016] Enable HTTP Strict Transport Security (HSTS)



In IIS, we can add a new header for our site, though, we can also set the response header at the server or folder level if necessary.
  • Open IIS Manager and select the site
  • Double-click on the HTTP Response Headers
  • Click Add…
  • Set the name to: Strict-Transport-Security
  • Set the value to: max-age=10886400 then click OK

Monday, December 11, 2017

[O365] Change/remove groups and teams SMTP addresses




  • List all groups and their addresses:



Get-UnifiedGroup | fl alias,*primary*,*emailadd* 

  • Change primary SMTP

Get-UnifiedGroup group1 | Set-UnifiedGroup -PrimarySmtpAddress group1@newdomain.tech

  • Remove SMTP address from old domain:

Get-UnifiedGroup group1 | Set-UnifiedGroup -EmailAddresses @{remove="group1@olddomain.com"}

  • List group addresses:

Get-UnifiedGroup group1 | fl alias,*primary*,*emailadd* 

Sunday, September 24, 2017

[LY13] Export address book to file



abserver -dumpfile "C:\LyncShare\n-WebServices-n\ABFiles\00000000-0000-0000-0000-000000000000\00000000-0
000-0000-0000-000000000000\F-0ef3.lsabs" c:\ABS-dump26Jun.txt

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

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

    [LY2013] Find the share of a pool




    #Quickly find and open the share folder for the Lync pool

    Invoke-Item(Get-CsService -FileStore | Select-Object -ExpandProperty UncPath)

    [EX2013] Recreate arbitration mailboxes




    Setup.exe /PrepareAD /IAcceptExchangeServerLicenseTerms

    Get-User | Where {$_.Name –like "SystemMailbox*"} | Enable-Mailbox -Arbitration -Database IT_E15
    Get-User | Where {$_.Name –like "FederatedEmail*"} | Enable-Mailbox -Arbitration -Database IT_E15
    Get-User | Where {$_.Name –like "Migration*"} | Enable-Mailbox -Arbitration -Database IT_E15

    Get-Mailbox –Identity "SystemMailbox{e0dc1c29*" –Arbitration | Set-Mailbox –Arbitration –DisplayName "Microsoft Exchange"

    Get-Mailbox –Arbitration –Identity "FederatedEmail*" | Set-Mailbox –Arbitration –ProhibitSendQuota 1MB

    Get-Mailbox –Arbitration –Identity "Migration*" | Set-Mailbox –Arbitration –ProhibitSendQuota 300MB

    [WSRV] Capture machine FQDN




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

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

    Tuesday, February 21, 2017

    [EX2010] Remove special characters in public folder name




    • Look for special character in public folder name:

    Get-MailPublicFolder | where {$_.alias.contains(' ') -or $_.alias.contains(',') -or $_.alias.contains('@') -or  $_.alias.contains('(') -or  $_.alias.contains(')') -or  $_.alias.contains(':') -or  $_.alias.contains(';')}



    • To fix the issue, run the cmdlet:

    Get-MailPublicFolder | where {$_.alias.contains(' ') -or $_.alias.contains(',') -or $_.alias.contains('@') -or  $_.alias.contains('(') -or  $_.alias.contains(')') -or  $_.alias.contains(':') -or  $_.alias.contains(';')}| Foreach { Set-mailpublicfolder -Identity $_.Identity -Alias ($_.Alias -replace "\s|\,|\@|\(|\)|\:|\;") }



    • Run the first command again to check if still there are public folders with unwanted characters in the name

    Monday, October 17, 2016

    [WSRV] Backup AD partition



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

    Sunday, August 7, 2016

    [W10] Cannot sysprep Windows 10 installation




    Check sysprep logs to review each modern application that needs to be removed

    Remove them from Store program list

    or 

    1. Run the Import-Module Appx PowerShell cmdlet.
    2. Run Import-Module Dism.
    3. Run Get-AppxPackage -AllUser | Where PublisherId -eq 8wekyb3d8bbwe | Format-List -Property PackageFullName,PackageUserInformation.

      Notes
      • In the output of this last cmdlet, check the users for whom the package is showing up as Installed. Delete these user accounts from the reference computer, or log on to the computer by using these user accounts. Then, run the cmdlet in step 4 to remove the Appx package.
      • This command lists all packages that were published by Microsoft and installed by any user of that reference computer. Because the computer is to be sysprepped, we assume that these user profiles no longer require the package.
      • If you have manually provisioned apps that belong to other publishers, run the following command to list them:

        Get-AppxPackage -AllUser | Format-List -Property PackageFullName,PackageUserInformation

    4. Run Remove-AppxPackage -Package <packagefullname>.
    5. Remove the provisioning by running the following cmdlet:

      Remove-AppxProvisionedPackage -Online -PackageName <packagefullname>

    Sysprep fails after you remove or update Windows Store apps that include built-in Windows images
    https://support.microsoft.com/en-us/kb/2769827

    [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

    Tuesday, May 10, 2016

    [EXO] Download pictures from users


    $user = Get-UserPhoto user@domain.com

    $user.PictureData | Set-Content "D:\Export\Photo$($user.Identity).jpg" -Encoding byte