PowerShell – Monitor MS Azure Status

February 22, 2015

If you are using MS Azure or MS Office 365 you are depending on the uptime of all the MS Cloud services.

Well to monitor this there is the Azure Status site.

image

This site offers for each service a RSS subscription to monitor the status.

In this case there was an issue, so we can kick in Powershell to grab the RSS output.

Here we go

 

CLS

$hsg = Invoke-WebRequest  "http://azure.microsoft.com/en-us/status/feed/"

$hsg.Content

[xml]$ret = $hsg.Content.TrimStart("")

#$ret.rss.channel.item | Select-Object *

write-host ""



if($ret.rss.channel.item.category -eq $null){

        write-host $ret.rss.channel.title " On : "  $ret.rss.channel.pubDate
        write-host "All services are working properly"
        write-host ""
    }
Else
    {

    write-host $ret.rss.channel.title " On : "  $ret.rss.channel.pubDate
    Write-Host "Issue Category : " $ret.rss.channel.item.category
    write-host ""
    Write-Host "Details : " $ret.rss.channel.item.title

    $ret.rss.channel.item.description
    write-host ""

}

rv hsg, ret
image

As you can see the raw XML data is prefixed (deliberately or not?) by a few strange characters which we have to eliminate before PowerShell can dig it.

So the final output is like this.

image

So you can create a job to have this run at a frequency to check for uptime issues.

Enjoy!

Advertisements

Google – Webmaster Tools for WordPress Configuration

February 22, 2015

Getting some statistics out of your blog is interesting to see how you are doing.

If you are using WordPress there are some native statistics available.

image

But the “Referrers” and the Search Engine details are limited to non existing

image

So there are some extra Tools you can add on.

Go the the WP Dashboard and go to the TOOLS section.

In there you see : “Website Verification Services“

You can add the “Google Webmaster Tools” for more detailed search statistics.

To get it running you need a verification code. Go to Google Webmaster Tools Fill in your URL.

Select Alternative Method – select HTML Tag and copy the Meta Tag.

image

Go back to WordPress Tools and past it in the Google Webmaster Tools section.

image

Next enjoy all the visitor and Google search statistics.

image

As a bonus you some some extra feature to tune the Google Search

image

Enjoy!


PowerShell – Access Windows Search

February 10, 2015

Windows has a Search feature that integrates in the OS and as well in Outlook.

Using the Control Panel you access the settings, which folders to index and which folders or Email folders.

image

image

To access the Search database you can use the “Search.CollatorDSO” Provider.

CLS

# GENERAL_COLUMNS
#$GENERAL_COLUMNS = "System.Kind"
$GENERAL_COLUMNS = "System.ItemPathDisplay"
#$GENERAL_COLUMNS = "System.ItemFolderPathDisplay"
#$GENERAL_COLUMNS = "System.Size"
#$GENERAL_COLUMNS = "System.DateCreated"
#$GENERAL_COLUMNS = "System.Author"
#$GENERAL_COLUMNS = "System.Keywords"

# DOCUMENT_COLUMNS
#$GENERAL_COLUMNS = "System.Image.HorizontalSize"
#$GENERAL_COLUMNS = "System.Image.VerticalSize"
#$GENERAL_COLUMNS = "System.Image.BitDepth"
#$GENERAL_COLUMNS = "System.Image.Compression"
#$GENERAL_COLUMNS = "System.Photo.CameraModel"
#$GENERAL_COLUMNS = "System.Photo.DateTaken"
#$GENERAL_COLUMNS = "System.Photo.Flash"

# MUSIC_COLUMNS
#$GENERAL_COLUMNS = "System.Music.Artist"
#$GENERAL_COLUMNS = "System.Music.Genre"
#$GENERAL_COLUMNS = "System.Music.TrackNumber"
#$GENERAL_COLUMNS = "System.Audio.Compression"
#$GENERAL_COLUMNS = "System.Audio.SampleRate"
#$GENERAL_COLUMNS = "System.DRM.IsProtected"
#$GENERAL_COLUMNS = "System.Music.AlbumTitle"
#$GENERAL_COLUMNS = "System.Rating"
#$GENERAL_COLUMNS = "System.Audio.EncodingBitrate"

# VIDEO_COLUMNS
#$VIDEO_COLUMNS = "System.RecordedTV.ChannelNumber"
#$VIDEO_COLUMNS = "System.RecordedTV.EpisodeName"
#$VIDEO_COLUMNS = "System.RecordedTV.NetworkAffiliation"
#$VIDEO_COLUMNS = "System.RecordedTV.RecordingTime"
#$VIDEO_COLUMNS = "System.Video.Compression"
#$VIDEO_COLUMNS = "System.Video.EncodingBitrate"
#$VIDEO_COLUMNS = "System.Video.FrameHeight"
#$VIDEO_COLUMNS = "System.Video.FrameWidth"    
  
$keyword1 = "PowerShell"  
$keyword2 = "au3"  
$extension = ".PDF"
$folder = "C:\"  


$objConnection = New-Object -com ADODB.Connection  
$objRecordSet = New-Object -com ADODB.Recordset

$objConnection.Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';")  
$objRecordSet.Open("SELECT $GENERAL_COLUMNS FROM SYSTEMINDEX WHERE System.FileExtension = '$extension' `
                    AND (Contains(Contents,'$keyword1') OR Contains(Contents, '$keyword2')) `
                    AND System.ItemPathDisplay LIKE '$folder\%'", $objConnection)  

if ($objRecordSet.EOF -eq $false) {$objRecordSet.MoveFirst() }  
  
while ($objRecordset.EOF -ne $true) {  
  $objRecordset.Fields.Item("System.ItemPathDisplay").Value  
  $objRecordset.MoveNext()  
 }


rv folder, extension, keyword1, keyword2

As you can see there are many columns you can search. Or using some Queries you can run this on your indexed mails

image

The bonus you get it that you can use this technology to do Remote Search over your network on a remote server or PC.

Enjoy !


PowerShell – Read JSON files

February 9, 2015

As we have seen Powershell can produce JSON output.

But what if we have to read a JSON file as input.

Here we go :

CLS
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null

$dlg = New-Object System.Windows.Forms.OpenFileDialog

$dlg.initialDirectory = """ + initialDir + """
$dlg.filter = "JSON files|*.JSON |Text Documents|*.txt | All Files|*.*"
$dlg.FilterIndex = 3
$dlg.Title = 'Select a file'
$dlg.ShowHelp = $True
$dlg.ShowDialog() | Out-Null
$dlg.ToFront

$dlg.FileName


$j = (get-content -Raw -path $dlg.FileName) | ConvertFrom-JSON 

$j.value

rv dlg,j

First of all we need to get Northwind Database to test.

The content looks like this :

image

Once downloaded you can run the PS Script.

It will bring up a File Selector Window

image

Select the Northwind.json file and look at the results.

image

Enjoy!


Windows – MS Network & MS Monitor Visual Round Trip Analyzer (VRTA)

February 3, 2015

At some point in time we had performance issues with our SharePoint Farm. Where users experienced at some site collection very slow response times.

Especially when this users connected from all over the world and from different continents.

We all know that internet traffic suffers a lot from latency.

How do you start analyzing the problem, whether this is a Server of client side performance issue. Or if this has to do with connectivity and speed from certain locations.

Well the VRTA will help a lot pinpointing the where the bottleneck is.

In order to get going you need to download :

MS NetMon and MS Visual Round Trip Analyzer (VRTA). Install both on your client machine.

Before starting to measure and gathering data, first some connectivity statistics from your remote location internet line speed using speedtest.net.

IMPORTANT : You need to measure between the location of your client AND the location of the SharePoint Farm.

This you can do for example by opening a Remote Desktop to the remote client or server. Open the Speedtest.net page, and before starting drag the green rectangle to the location of where the SP farm is located (or most nearby).

image

Once you have done this and started measuring, you know approximately the up and download speed of your connection.

If this is weak in upload speed, of course users start complaining when uploading large documents to you SharePoint farm.

If the latency is too high also download speed will suffer as well.

Now let’s get started using the tools.

image

Open VRTA and a Browser.

Start VRTA (see picture) then open SharePoint homepage.

image

And immediately after that open you SharePoint page that you want to measure.

When the page finished loading, stop the recording.

image

The main chart will give you an interactive chart display of the loading time of each of the components of the page. And any other communication on that network connection !

So make sure to have all other internet services and connections inactive while capturing the traffic. Otherwise the results are polluted.

image

The statistics give you already a good idea of the reaction time of your site or site collection, and which items on the page are slowing it down.

image

Next go to the All Files tab select all and copy it to an excel sheet.

image

Save the test.

Repeat it for document uploads and downloads.

Download Test file of 1Mb

So upload a 1 Mb Test file from the client to the SharePoint site, start capturing the traffic.

And reverse the exercise by downloading the same file to the client, and capture the traffic while downloading.

Gather all statistics in an Excel file from different locations, and from different sections of your SP Site.

image

You easily see if for example picture how long they take to download on the client. Which can slow down the performance to your pages loading.

Combine these test results with the Line Speed statistics and Ping / Latency results.

image

And you are ready to go to make a global overview of how good or bad your SharePoint is doing, or where the connectivity needs improvements.

PS : Our outcome was that the SharePoint Farm was doing OK, but we needed to increase bandwidth at certain remote locations.

These kind of tests take away all kinds of speculations of end users trying to shoot at your infrastructure guys. Blaming the SharePoint server is no good Winking smile

It is also good to show the management who will have to approve the extra CAPEX Smile


MS Exchange – Grant permission to Distribution Groups in the GAL

February 3, 2015

Certain users in the organization where not able to edit (add / remove ) users from a Distribution group in the GAL.

This was the error they say in the Outlook.

“Changes to the public group membership cannot be saved …”

image

Nevertheless the user itself had Ownership ?

image

After Googling a bit, it seems that this is a dafault behavior of Exchange 2010 and higher.

So you need to change the Roles & Policies that are connected to the users, using the web ECP.

In order to allow the editing of the a Distribution Group from within Outlook.

image

Also the Membership Approval settings must be correct.

image

Next check the security settings via the ADUC on this Distribution Group Object. Make sure that this user has sufficient control.

image

Some more interesting readings are over here :

http://support.microsoft.com/kb/2586832/en-us#R1

http://blogs.technet.com/b/exchange/archive/2009/11/18/how-to-manage-groups-that-i-already-own-in-exchange-2010.aspx

You can of course use PowerShell to manage the Distribution Groups

Using : Get-ManagementRole cmdlet

“get-managementrole MyDistributionGroupMembership | get-member”

image