[Powershell] Remove Spaces from User Input if you will Build an Array

In one of the scripts I came across, The users have  to input IP addresses in the form of: IP1,IP2,IP3,…etc. The Powershell script will take this input and build an array to be passed to NETSH and other network commands. The problem is, the users will for different reasons enter the IPs in the form of: IP1, IP2, IP3, … adding an extra space after “,” sometimes there’s a leading or trailing spaces from copy and paste from other places. The result is ==> the network commands was failing to process these extra spaces. Anyway, to solve this, and to avoid similar situations, When you are getting a variable from users, it’s a good practice to do some cleanup, because you will never know what users will enter. One good example, is to utilize –replace parameter with \s to remove all spaces, tabs So:

$Param = "   10.10.10.1            ,  10.10.10.2           ,  10.10.10.3    "

#You clean it up by:
$Param = $Param -replace '\s',''

#This will make:
$Param

#Returns:
10.10.10.1,10.10.10.2,10.10.10.3

UPDATE#1:
It also worth mentioning that, If you only want to remove the leading and trailing spaces from the users input, Use the Trim() method. So:

$Param = "   First Name Last Name    "

#You clean it up by:
$Param = $Param.trim()

#This will make:
$Param

#Returns:
First Name Last Name

Exchange 2013 Preferred Architecture

Here’s a cut-to-the-chase summary of The Preferred Architecture blog by Ross Smith IV, you will find a link for the original article at the end of this blog.

Here’s the summary (with el touch beta3y):

  • Simplicity, Simplicity, Simplicity.
  • For each exchange service (OWA, SMTP,…) Use one name that balances the connections between the 2 datacenters (If you have 2 Datacenter with “fast” network connection).
  • Each datacenter is a separate AD site.
  • All Exchange servers are multi-role servers (Each Server have Mailbox and CAS roles).
  • All Exchange servers are Physical servers!!!
  • 2 Disks in a RAID 1 to host the OS, Exchange binaries, protocol/client logs, and transport database.
  • JBOD SAS 7.2K disks with large capacity for Databases files and logs.
  • AutoReseed is enabled, and at least 1 disk is reserved for it.
  • DAG is stretched across the 2 Datacenters, and active copies distributed equally across all servers in the DAG.
  • Each Datacenter have the same number of Servers in the DAG.
  • The DAG have even numbers of servers, and a witness server is used for for quorum arbitration.
  • DAG’s witness server is placed in a third reliable Datacenter.
  • Use a single network card that will carry both MAPI and Replication traffic (Assuming you network infrastructure can provides 10 Gb end-to-end).
  • Each database has four copies, with two copies in each datacenter
  • ReplayLagTime is 7 days for the lagged database copy (Set-MailboxDatabaseCopy -Identity DatabaseName\MailboxServerName -ReplayLagTime 7.0:0:0)
  • Backup, Backup, backup.

References:

The Preferred Architecture

Configure AutoReseed for a database availability group

Exchange 2013 (low on log volume space) Alert: The Reason and How To Override

If you are monitoring Exchange 2013 Servers, you may receive this alert from your Mailbox Servers:

Database ‘DATABASE’ is low on log volume space. ‘DATABASE’ is low on log volume space. Current=xx GB, Threshold=195.31 GB

You can check the status also by issuing this command in the Exchange Management Shell:

Get-ExchangeServer | Get-Serverhealth -HealthSet Diskspace | ? AlertValue -ne Healthy | ft –autosize

The reason is because Exchange expects that there will be at least 200 GB (or 195.31 GB) free disk space on the disk hosting the database log files. which might not be the case for your deployment, probably because you don’t need all that much of space.

The solution is simple (It will work for Exchange 2013 With SP1 (CU4) or later):

1- Open Powershell on your Mailbox Server(s).

2- Run this command (Replace 10240 by your desired value of Free Disk Space threshold in MB):

New-ItemProperty "HKLM:Software\Microsoft\ExchangeServer\v15\ActiveMonitoring\Parameters\" -Name "SpaceMonitorLowSpaceThresholdInMB" -Value 10240 -PropertyType "DWord"

Supported or not Supported, this is the Question

Summary of Lync Supported and Non-Supported Configurations

The Lync Dude

Howdy,

: thanks to Lync MVP Thomas Poett, and his input, I updated the article

how many times did you stumble upon a question from a customer if a certain feature or deployment scenario is supported by Microsoft and Lync 2013 or not.

we all forget, I mean there is a new stuff happening in our world (UC) every minute and sometime we loss tracks, so I have what I call my SCS (supported Cheat sheet) where I keep all information I have through my years in Lync by something I read or researched or learned from someone else about Lync supportabilities, and I decided to share it here in a blog article about what is supported or not supported regarding Lync 2013.

feel free please to correct my information, or put a comment about something I did not mentioned and I will be add it to this article…

View original post 909 more words

One-Liner: Open Start Menu From Powershell

Working on Windows Server 2008 in a RemoteDesktoption (remote desktop inside remote desktop inside remote desktop), It’s a challenge to point the mouse curser to the exact lower left pixel to open the start menu.

Good News, Just open Powershell, and past this one-liner to simply open the start menu  without changing anything or creating any files on the server.

 $wshell = New-Object -ComObject wscript.shell;$wshell.SendKeys('^{ESC}')

P.S.: Of course you can also create a VBS script to do same. but in my case, this wasn’t preferable.

Simple Understanding of Lync Windows Fabric & Failover

Why you should deploy “3” Frontend Servers in Lync Server 2013 Enterprise pools.

The Lync Dude

Howdy,

I saw a scary number of Lync 2013 deployments in the last 8 months where the Lync is deployed using an Enterprise pool with only two front end servers, even I saw a couple that have an Enterprise pool with only one front end server, yes you read that right, only one front end server.

So I decided to write another post of my “Simple Understanding” article series aimed to explain the Lync 2013 server architecture, how it utilize windows fabric for high availability and why you should not deploy a 2 nodes Enterprise Edition pool, I’ll try to use small words and simple explanations as I can.

I’m planning also to use this article as a guide to share with customers which have an existing Lync deployment or considering Lync to help them in their decisions.

View original post 1,514 more words

SQL Server 2012 automated Install ini Feature list

Good reference to interpret/create SQL installation ini file

Understanding SQL

Any DBA worth their salt will have automated the deployment of any version of SQL server using a SQL server configuration ini and a standard installation script. Through the ini, you can manage exactly what you required to be installed, where you want it installed and how you want your features to run.

With the introduction of SQL Server 2012, Microsoft introduced some new features that can be included in your network standard installation, so I figured it was time to update the list of features and their abbreviated name that needs to be included in the ini.

In your ini, you will have a line approximate to this:

FEATURES=SQLENGINE,REPLICATION,FULLTEXT,DQ,AS,RS,RS_SHP,RS_SHPWFE,DQC,BIDS,CONN,IS,BC,SDK,BOL,SSMS,ADV_SSMS,DREPLAY_CTLR,DREPLAY_CLT,SNAC_SDK,MDS

For reference, here are the full names:

Ini
name

Feature

SQLENGINE

SQL
Server Engine

REPLICATION

Replication

FULLTEXT

Full
text Search

DQ

Data
Quality Services

AS

Analysis
Services

RS

Reporting
Services – Native

RS_SHP

Reporting
Services – SharePoint

RS_SHPWFE

Reporting
Services…

View original post 75 more words