Tag: powershell

On-premise Exchange 2010 headaches

by on Sep.01, 2019, under Code, Posts

If you’ve worked in IT and have inherited other systems and networks to manage, you can definitely relate to having to work with situations that are less than ideal. Best practices can’t always be followed due to various reasons. (One main reason seems to be money related.) I am currently working with a client that has on-premise servers that are all bare metal and under-specced. We are in the process gathering information on their current setup and plan to decommission and consolidate their on-premise servers, and push them to use Office 365 instead.

I hope this post helps someone because I was having next to no luck being able to access the Exchange Management Shell. Oddly, the GUI tool worked fine, but I wanted to run powershell scripts to generate reports on the current configuration of the said Exchange server. Clicking on the powershell management shell for Exchange icon would result in:

I troubleshooted all the suggested steps suggested in the error output and everything appeared to check out fine. I then just tried using a standard powershell prompt to try to authenticate to the local exchange powershell, and started getting errors like:

[ExchServer] Connecting to remote server failed with the following error message : The WinRM client received an HTTP status code of 403 from the remote WS-Management service. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (System.Manageme….RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc eption + FullyQualifiedErrorId : PSSessionOpenFailed

I found it curious that I was starting to get different error messages and felt like I was starting to get closer to being able to authenticate. What ended up working for me was to issue this command:

$session = new-pssession -configurationName Microsoft.Exchange -connectionuri http://change.me.local/PowerShell/ -Authentication Kerberos -credential $credential 

You are then prompted with a gui logon prompt. Make sure to use Domain\UserName in the username field then use the proper password. Lo and behold, no errors were given and it looks like I was authenticated! To import the exchange powershell modules, issue this command:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010;

Again, I really hope this helps save someone a headache and time. As for the root of what’s causing the powershell management shell for Exchange icon shortcut to fail, I’m not clear. So at this point this is just a workaround.

Leave a Comment :, , , , , , , , , , , , , , , , , , more...

K.I.S.S. Windows Server Backup Failure Notification Powershell script

by on May.03, 2018, under Code, Posts

$value = get-wbsummary | select -expandproperty lastbackupresulthr

if ( $value -ne 0 )
$EmailFrom = “YourGmailAccount@gmail.com”
$EmailTo = “WhoYouWantTonotify@domain.com”
$Subject = “Notification from Windows Server Backup”
$Body = “Last backup may have failed…”
$SMTPServer = “smtp.gmail.com”
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“YourGmailAccount”, “yourcleartextpassword”);
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

The code is pretty self explanatory. (The main block I just found from howtogeek.com) Granted it is not secure because it’s storing a cleartext password. You can save this in a .ps1 file and create a scheduled task that runs with at least admin privileges (the function ‘get-wbsummary’ requires admin rights) after a backup has ran.

The $EmailTo variable you could use an SMS gateway to get a text notification. (See this list.) For instance if your phone number is 6165559876 and you have Verizon, it would look like this: $EmailTo = 6165559876@vtext.com.

Leave a Comment :, , , , , , , , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!