How to replace a drive in Storage Spaces

source: https://hodgkins.io/replace-failed-disk-in-storage-spaces-pool-with-powershell

 

 

# Find the failed Disk
Get-PhysicalDisk
# Shutdown, take the disk out and reboot. Set the missing disk to a variable
$missingDisk = Get-PhysicalDisk | WhereObject { $_.OperationalStatus -eq ‘Lost Communication’ }
# Retire the missing disk
$missingDisk | Set-PhysicalDisk Usage Retired
# Find the name of your new disk
Get-PhysicalDisk
# Set the replacement disk object to a variable
$replacementDisk = Get-PhysicalDisk –FriendlyName PhysicalDisk1
# Add replacement Disk to the Storage Pool
Add-PhysicalDisk –PhysicalDisks $replacementDisk –StoragePoolFriendlyName pool
# Repair each Volume
Repair-VirtualDisk –FriendlyName <VolumeName>
# Get the status of the rebuilds
Get-StorageJob
# Remove failed Virtual Disks
Remove-VirtualDisk –FriendlyName <FriendlyName>
# Remove the failed Physical Disk from the pool
Remove-PhysicalDisk –PhysicalDisks $missingDisk –StoragePoolFriendlyName pool

Use wmic to get details from your server

Here is a few line you can run at cmd.exe to get some information that you may use..

To get the serialnumber:

wmic bios get serialnumber

To get a model description:

wmic scproduct get name

To get the productnumber (SKU):

wmic /node:»server-name-here» /namespace:\rootwmi path MS_SystemInformation get SystemSKU

How to connect to Office 365 Exchange with powershell

 Fire up powershell

 

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

To disconnect the session:

Remove-PSSession $Session

shared mailbox Office 365 – cannot expand folder both in OWA and Outlook

There is a bud in the GUI of Office 365 when delegating full permission to a user for shared mailbox.

Even if you give the correct permission you cannot expand the mailbox.

The fix is to remove and readd the permission with these powershell comamnds:

To Add

Add-MailboxPermission -Identity JDoe -User ‘testuser22’ -AccessRights FullAccess -InheritanceType All -AutoMapping $false

To Remove

Remove-MailboxPermission -Identity JDoe -User ‘testuser22’ -AccessRights FullAccess -InheritanceType All

How to remove system mailboxes and arbitration / federated mailboxes from last Exchange 2010 / 2013

This is just a plain copy paste for a note for myself.

please visit http://msexchangeguru.com/2013/01/02/exchange-2013-error/ which is the source for this paste

To resolve this, we need to move or disable the arbitration mailboxes on the server and remove the mailbox database manually.

You need to also ensure you do not have any user mailboxes in the database you are trying to get rid of.

Start Exchange Management Shell and type the command to display mailboxes in the whole forest and not just the domain you are logged into:

[PS] C:Windowssystem32>$AdminSessionADSettings.ViewEntireForest=$True

[PS] C:Windowssystem32>Get-MailboxDatabase -Server nbc-d-mbx02

Name Server Recovery ReplicationType

—- —— ——– —————

Database15         NBC-D-MBX02 False None

[PS] C:Windowssystem32>Get-MailboxDatabase “nbc-d-mbx02Database15” | Get-Mailbox

Now that you have the list of all mailboxes in the exchange database, move it to a different server

To work around the Arbitration mailbox issue, let’s find out the list of all Arbitration mailboxes

[PS] C:Windowssystem32>Get-Mailbox -Arbitration |ft Name, Servername

Name ServerName

—- ———-

SystemMailbox{1f05a927-0695-4348-bb62-d2369dcb23d5} nbc-d-mbx01

FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042 nbc-d-mbx01

SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} nbc-d-mbx02

SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c} nbc-d-mbx02

Migration.8f3e7716-2011-43e4-96b1-aba62d229136 nbc-d-mbx02

Now will disable all of those since I do not have a different server to move them to.

[PS] C:Windowssystem32>Disable-Mailbox “SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}” -Arbitration -DisableLastArbitrationMailboxAllowed

Confirm

Are you sure you want to perform this action?

Disabling mailbox “SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}” will remove the Exchange properties from the Active Directory user object and mark the mailbox in the database for removal. If the mailbox has an archive or remote archive, the archive will also be marked for removal. In the case of remote archives, this action is permanent. You can’t reconnect this user to the remote archive again.

[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): a

[PS] C:Windowssystem32>Disable-Mailbox “SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c}” -Arbitration -DisableLastArbitrationMailboxAllowed

Confirm

Are you sure you want to perform this action?

Disabling mailbox “SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c}” will remove the Exchange properties from the Active Directory user object and mark the mailbox in the database for removal. If the mailbox has an archive or remote archive, the archive will also be marked for removal. In the case of remote archives, this action is permanent. You can’t reconnect this user to the remote archive again.

[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): a

[PS] C:Windowssystem32>Disable-Mailbox “Migration.8f3e7716-2011-43e4-96b1-aba62d229136” -Arbitration -DisableLastArbitrationMailboxAllowed

Confirm

Are you sure you want to perform this action?

Disabling mailbox “Migration.8f3e7716-2011-43e4-96b1-aba62d229136” will remove the Exchange properties from the Active Directory user object and mark the mailbox in the database for removal. If the mailbox has an archive or remote archive, the archive will also be marked for removal. In the case of remote archives, this action is permanent. You can’t reconnect this user to the remote archive again.

[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): a

[PS] C:Windowssystem32>Get-MailboxDatabase -Server nbc-d-mbx02

Name Server Recovery ReplicationType

—- —— ——– —————

Mailbox Database 0912423282 NBC-D-MBX02 False None

[PS] C:Windowssystem32>Remove-MailboxDatabase “Mailbox Database 0912423282”

Confirm

Are you sure you want to perform this action?

Removing mailbox database “Mailbox Database 0912423282”.

[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): a

WARNING: The specified database has been removed. You must remove the database file located in E:Program FilesMicrosoftExchange ServerV15MailboxMailbox Database 0912423282Mailbox Database 0912423282.edb from your computer manually if it exists. Specified database: Mailbox Database 0912423282

Remove autodiscover from Exchange 2010 after migrating to Office 365

This is just a 100% copy from this excellent blog as a note for myrself. : http://kirb.it/enable-office-365-auto-discover-for-outlook-in-sbs-2011-exchange-environments/

 

Enable Office 365 Auto-discover for Outlook in SBS 2011 Exchange Environments

One of the  issues you will run into when migrating from an on premises Exchange 2010 server on SBS 2011 is that Outlook will not autodiscover the correct Office 365 server settings. Fortunately this can be easily solved with a few simple PowerShell commands.

  1. Open an Exchange Management Shell as an administrator. (Elevated PowerShell)
  2. Use the following command to discover the Identity name of your Autodiscover Virtual Directory. Either note or copy the values in the Identity field.
    Get-AutodiscoverVirtualDirectory | fl Name, Server, InternalUrl, Identity
    Retrieve Exchange Autodiscover Virtual Directory Settings - SBS 2011
  3. Use the following command to remove the AutoDiscover Virtual Directory. Be sure to replace the text inside the quotes with the value in the Identity field above.
    Remove-AutodiscoverVirtualDirectory –Identity “Insert identity value here”
     Virtual Directory for Exchange 2010
  4. You will have to confirm the removal by hitting Y for yes when prompted. You can double check to see if this worked properly by rerunning the command in step 2.  You should get a blank result if successful.

That should be it. Your Outlook clients should connect successfully to the Office 365 service.

 

Free space on your Windows Deduplicated volume

In Windows 2012 R2 you can enable deduplication on a volume. This can save tons of space and I use lit a lot when I save f.eks Veeam backup files. You can easy get a saving of 50-70% of your avaiable space.

An «issue» though; if you want to delete some files and get your space back, you will have to wait for a week… ( https://technet.microsoft.com/en-us/library/hh831434.aspx ) Look at the Garbage collection part…

You can alse see this by typing the following in powershell:

Get-DedupSchedule

Here yu can see the garbagecollection is set to run weekly at Saturday 02:45

There is a workaround if you want to get your space back sooner; run this powershellscript where D: is the letter of yuour deduplicated volume:

Start-DedupJob -Type GarbageCollection -Priority High -Volume D:

You can even schedule this job to run f.ex once a day if you want to get your space back at a daily level:

Set-DedupSchedule –Name "FreeSpace" –Type GarbageCollection –Start hh:ss –DurationHours 5 –Days Mon,Tues,Wed,Thurs,Fri,Sat,Sun –Priority High

Replace hh:ss with the time you want to perform the job, also remove unwanted days if not needed.

Source: http://blog.cloud-client.info/?p=1452

Delete all the items in a maibox in Exchange 2013

I imported an .pst into the wrong mailbox (but before I gave the credential to the user..) and with 25.000 emails this was not something I would want to do in Outllok with hang etc…

So how can I do this directly on the Exchange 2013 server? Easy! With a one-line in powershell!

But you have to give your administrator the Mailbox Search role and Mailbox Import Export in the ECP. Look at this wonderful blog on how you do that first: http://blogs.technet.com/b/samdrey/archive/2011/02/17/exchange-2010-rbac-issue-mailbox-import-export-gt-new-mailboximportrequest-and-other-management-role-entries-are-missing-not-available.aspx

So how do I delete the content with a one liner?

Search-Mailbox -Identity «name of mailbox» -DeleteContent -Force

What we do is basically doing a search in the mailbox without filtering and delete the results. With this approach you can lso filter certain elements and just delte them.

F.ex if you just want to delete all calendar entries in a mailbox:

Search-Mailbox -Identity «name of mailbox» –SearchQuery kind:meetings –DeleteContent

You can also show the estiates on what would be deleted without actually deleting anything by adding –EstimateResultOnly at the the end:

Search-Mailbox -Identity «name of mailbox» –SearchQuery kind:meetings –DeleteContent –EstimateResultOnly

Fore more specific filter, look at this blog which is also the source for my blog:

http://theucguy.net/delete-all-calendar-entries-in-an-exchange-2010-mailbox/

 

 

 

Opprett en gratis blogg eller et nettsted på WordPress.com.

opp ↑