PowerShell

Windows 8: fixing trust relationship issues

Dear Jermal, here is some info that you may find useful in the future. I hope that you share with your friends, coworkers and the readers of your blog.

From time to time I have found myself having to reset the computer account of a workstation that was left offline. In most cases this workstation was a virtual machine with a computer password that expired. A clear sign of this is the message “The trust relationship between this workstation and the primary domain failed.” 

This can be fixed by classic steps of removing the computer from the domain and then joining it back. You could also attempt to log into active directory users and computers and reset the computer object; I haven’t had much success with this. Perhaps I’m to impatient to wait for replication.

Another method is to use PowerShell and the Test-ComputerSecureChannel method.

By loading up PowerShell (as Administrator) you can run the Test-ComputerSecureChannel cmdlet (pronounced “command-let”). Running this command on a working machine will return the value of “True”

If the Test-ComputerSecureChannel cmdlet returns False, use the Repair switch to repair the secure channel. That command will look like this: “Test-ComputerSecureChannel

I hope this helps,

Sincerely,

Jermal

 

P.S. – You will need to be logged in under a cached Administrator account on the computer; To do this you just remove yourself from the network and log in under your credentials.

 

Exchange 2013: Migrating Mailboxes via PowerShell

Exchange 2013 has new and impressive administration center that allows you to handle tasks such as mailbox moves. I prefer using the Exchange Management Shell for such a task.

Using the following command you can move all mailboxes within a database to your new mailbox database: Get-Mailbox -Database “Source-Database” | New-MoveRequest -TargetDatabase “Destination-Database”

To get info on the migration progress you can use the following command syntax: Get-MoveRequestStatistics -MoveRequestQueue “Destination-Database”

Once this migration has completed you can check if anything exists in the source database with the following: Get-MailboxDatabase -Identity “Source-Database” | Get-Mailbox

Exchange 2013: Get Mailbox Move Request Statistics

After some weekend Exchange mailbox migrations I wanted to check the status of mailboxes. This is where I use the Get-MoveRequestStatistics for the all mailboxes or database.

Issuing the following command: Get-MoveRequestStatistics -MoveRequestQueue “*databasename*” will return to you the status of all the mailboxes on that data store. This is good; but what if you are only interested in the status of the databases that are currently being migrated over.

Issuing the following command seems to do the trick:
Get-MoveRequest | where {$_.status -ne ”Completed”} | Get-MoveRequestStatistics

As you see above we used the ‘where’ clause to select all of the database moves that are not in a “Completed” status.

Another command I found useful is used to show if mailboxes exist within a particular database, which is very useful when migrating mailboxes and validating if they old database is now free of mailboxes.

The command I use is: Get-MailboxDatabase -Identity “OLDSTORE1” | Get-Mailbox

PowerShell: Set Network Profile

Looking to change the network profile of my public facing adapter from Public to Private I recently found out I can use the PowerShell command Get-NetConnectionProfile to return the the connection profile associated with one or more physical network adapters.

Once I have this information I can then modify the NetworkCategory to what I wish by using the Set-NetConnectionProfile command.

Example: Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private 

How awesome is that

Resources: http://technet.microsoft.com/en-us/library/jj899566.aspx

Resources: http://technet.microsoft.com/en-us/library/jj899565.aspx

 

PowerShell: Get basic network adapter properties

Get-NetAdapter cmdlet returns to you the basic network adapter properties of visible adapters installed on your system. This is a very useful tool to gather some details about your installed network adapters.

More info and features can be found here: http://technet.microsoft.com/en-us/library/jj130867.aspx

 

Pre-Requisites Time – Coming Soon

I open PowerShell as Administrator and type the following:

Install-WindowsFeature AS-HTTP-Activation, Desktop-Experience, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation

followed by pressing enter…

what next you ask?  Well stop by later and find out.

SharePoint 2010 – Updating Webpart Solution

Similar to my previous post SharePoint 2010 – Deploying Webpart Solution, the upgrade process of a Webpart Solution you have a few steps to take to make this all happen.

As I did in my previous post:

I copied the webpart to the local disk of my SharePoint 2010 server. Placing it in a folder c:install this time around I am not going to be running the command Add-SPSolution c:installSharePointWebpart.wsp as it already exist. If you do you will get an error stating that the solution already exists.

What you will need to do is run the following command for example: Update-SPSolution –Identity SharePointWebpart.wsp –LiteralPath c:installSharePointWebpart.wsp –GACDeployment

For more info on features and solutions cmdlets: http://technet.microsoft.com/en-us/library/ff607724.aspx

SharePoint 2010 – Deploying Webpart Solution

The process of installing a custom webpart solution doesn’t have to be a complex task. In fact all you need to do is run two commands In Power Shell and activate the custom webpart and you are done.

So here are some steps I took recently:
Copied the webpart to the local disk of my SharePoint server, I placed this file in c:install
Add-SPSolution c:installSharePointWebpart.wsp
Install-SPSolution –Identity SharePointWebpart.wsp –WebApplication http://somesite –GACDeployment

After the install of the w webpart you will need to do the following to make it active.
I navigated to the site where my new webpart solution was deployed: http://somesite
Then clicked on Site Action followed by Site Settings
Under Site Collection Administration I then entered Site Collection Features
Under Site Collection Administration > Features I located the webpart and clicked activate

Now the web part is available for use.

I hope this helps

Removing an auto-mapped mailbox

In Exchange Server 2010 SP1, shared mailbox with full access rights will be auto mapped to the users given such rights. This is fine for that user who doesn’t seem to know how to add an additional mailbox to their Outlook 2007, 2010, 2013 client. But what about those support and systems admins who grant themselves access for troubleshooting and find out later they are stuck with this new folder under their Outlook folder that can’t be removed.

Well we never say “can’t”. So what you need to do to remote the auto-mapping attribute is to reach out to the administrator if you are not one or if you are just find your way to the Exchange Management Power Shell and issue the following command:

Add-MailboxPermission -Identity <shared mailbox alias> -User <your mailbox alias> -AccessRights FullAccess -InheritanceType All -Automapping $false

Once this command is run the additional mailbox will automatically be removed.

Reference: Disable Outlook Auto-Mapping with Full Access

Simple Exchange 2010 Database White Space Report

I was looking at some of my database on Exchange that seemed to be very large in size so first thought was that an offline defrag may be needed, but before I reach that point I wanted to know how much ‘slack’ or white space existed in each of my Exchange databases.

This was done by using the following command syntax in the Exchange Management Shell:

To export this into a CSV format the following can also be done, so that you can give to any management members for review of your findings:

Next, I may find a way to setup this to email a weekly report…