Wednesday, 28 August 2013

AppleScript: Mount Drive / Connect to Server with Choose from List

I have written a script to mount drive / connect to server which you can select the drives that you would like to mount or the servers that you would like to connect from a list.


AppleScript:
property server_list : {{name:"SMB", address:"smb://UK;User1@test.uk.local", volume:"User1"}, ¬
      {name:"AFP", address:"afp://test.uk.local/", volume:"User2"}, ¬
      {name:"SMB", address:"smb://UK;User3@test.uk.local", volume:"User3"}}

tell application "Finder"
      try
             eject disk "share"
      end try
end tell

set display_list to {}
repeat with the_item in server_list
      set display_list to display_list & name of the_item
end repeat


set choice to choose from list display_list with title "Mount Drive " with prompt "Please select your name to mount your drive" with multiple selections allowed
if result is false then return

if choice is not {} then
      repeat with the_name in choice
             repeat with the_server in server_list
                  
                   if (name of the_server) is equal to the_name as string then
                          try
                                tell application "Finder"
                                      set x to mount volume (address of the_server & "/" & volume of the_server)
                                      log address of the_server
                                      display dialog "You have mounted your drive successfully. Click OK to exit." with title "Mount Drive" with icon note buttons {"OK"} default button 1
                                      return
                                end tell
                          end try
                          return
                   end if
             end repeat
            
      end repeat

end if

Tuesday, 27 August 2013

Google: Website / Internet Monitoring with Google Docs

Most company owners use website / Internet monitoring services to track the downtime and uptime of their sites / Internet.  These service offer free plans but you often have to upgrade for unlimited email  / SMS alerts or if you would like to monitor a large number of websites.

Good news is that you can now use Google Docs to monitor your website(s) and, unlike the commercial services, Google imposes no restrictions. You can track any number of websites with Google Docs and it will send email /text alerts in case of any issues. In addition, this DIY website monitoring tool is absolutely free.

Here’s how you quickly configure Google Docs to monitor the uptime /downtime of your website(s). This has to done just once and Google Docs will continuously monitor all your sites in the background.

Let’s get started:
  1. Sign-in to your Google account and then click here to copy this Google sheet into your Google Drive. You may use your Google Apps account as well.
  2. Put your website URLs in cell B2 (comma separated) and your email address in cell B3. If you wish to be alerted by text messages, just replace No with Yes in cell B4.
  3. You’ll find a new Website Monitor menu in your Google Docs toolbar. Click Initialize and you’ll get a pop-up asking for authorization. Grant the necessary access.
  4. Go to the Website Monitor menu again and choose “Start” to begin the monitoring process.  Close the Google Sheet.


That’s it. The Google Docs sheet will monitor your website in the background at 5-minute intervals and will send alerts whenever it has trouble accessing the website. If the issue is resolved, you’ll get another notification saying “all’s well.”

The uptime and downtime times get logged in the same Google Docs sheet so you can use that data to analyse the performance of your web hosting company.

Internally, there’s a simple Google Script attached to the Google Docs sheet that does the monitoring.

The script invokes itself every 5 minutes, with the magic of Script Triggers, and then tries to fetch your website using URLFetchApp.fetch (a Google function similar to wget or curl). If the HTTP response code is anything other than 200, it indicates that there’s an issue with the underlying website.

Google Apps Script can send email messages but the script employs a workaround for sending text messages.

It creates a regular event in your Google Calendar but with an SMS reminder  - the event is set to expire in 30 seconds and thus you get an instant text alert on your mobile. If you aren’t getting text alerts on your phone, please ensure that your phone number is associated with Google Calendar as detailed in this tutorial.




Google Apps Script:
/*
   Website Monitor 
   ===============
*/
function init() {
  if (ScriptApp.getScriptTriggers().length == 0) {
    // Set up a monitor that triggers every 5 minutes
    ScriptApp.newTrigger("websiteMonitor")
      .timeBased().everyMinutes(5).create();
  }
}

function websiteMonitor()
{
  var response, error, code, urls;

  // The script can monitor multiple website URLs (comma separated)
  urls = SpreadsheetApp.getActiveSheet().getRange("B2").getValue();
  urls = urls.replace(/\s/g, "").split(",");
 
  for (var i=0; i<urls.length; i++) {
   
    var url = urls[i];
     
    if (!ScriptProperties.getProperty(url)) {
        ScriptProperties.setProperty(url, 200);
    }
   
    // Trying to connect to the website URL
    try {  
      response = UrlFetchApp.fetch(url);
    } catch(error) {
      // If URLFetchApp fails, the site is probably down
      updateLog(url, -1);
      continue;
    }
   
    code = response.getResponseCode();
    updateLog(url, code);
   
  }
}

function updateLog(url, code) {
 
  if (ScriptProperties.getProperty(url) == code)
    return;
 
  ScriptProperties.setProperty(url, code);
 
  var sheet = SpreadsheetApp.getActiveSheet();
 
  var row   = sheet.getLastRow() + 1;  
  var time  = new Date();
  var msg = "Down";
 
  if (code == 200)
    msg = "Up";
 
  msg = "Website is " + msg + "  " + url;
 
  sheet.getRange(row,1).setValue(time);
  sheet.getRange(row,2).setValue(msg);
 
  // Send an email notification when the site status changes
  var email = sheet.getRange("B3").getValue();
  MailApp.sendEmail(email, msg, url);
 
  var now   = new Date(time.getTime() + 10000);

  // Create an event in Google Calendar with an SMS reminder
  if (sheet.getRange("B4").getValue().toLowerCase() == "yes")
    CalendarApp.createEvent(msg, now, now).addSmsReminder(0);
}


Reference:
1. Monitor your Website’s Uptime with Google Docs

Microsoft: Bulk Documents Printing / Printing Multiple Documents at Once

You may print multiple documents at once by following the steps below:

1. Go to Start > Devices and Printers
2. Double click on the specific printer and a print queue window will prompt out ( Figure 1 )
3. Drag and drop the documents that you would like to print into the print queue window
4. Click OK to confirm the printing of multiple files at once ( Figure 2 )

Figure 1

Figure 2

Note:
Personally, the file formats that I have tested for this bulk printing are PDF, MS Word, MS PowerPoint and MS Excel.

Thursday, 22 August 2013

IT Technology: SwiftCache

SwiftCache is a proven high performance media-caching appliance designed specifically to handle the challenges of the modern Internet. The intelligent caching engine is optimised for video caching (including live-streaming), as well as more traditional content such as websites or images.

For you as a network service provider, this means you can provide a better service to your subscribers, while realising big savings.


Features:
  • Appliance models with specifications to suit the size of your network and the complexity of your caching needs
  • Optimised for video delivery and the modern Internet
  • Easy management via a web-based GUI, or with scriptable CLI or SNMP
  • Highly flexible policy configurations to handle dynamic URLs, video-seek requests, and other such content that has traditionally been very difficult to cache effectively
  • Cloud-based service for rule updates to ensure optimal cache performance
  • No disruption to non-HTTP content
  • Overload or bypass mode to ensure that, should the cache become overloading, it will not disrupt user experience
  • Comprehensive reporting, including cache hit-rates and traffic levels on a per-site basis for most popular sites
  • Clustering and inter-cache communication, for greater scalability and resilience, with the ability to manage and configure the cluster as a single machine
  • Content Filtering, including using white and black-lists or selection by category e.g. social media


Compelling Benefits:
  • By deploying SwiftCache within your network, you can: -
  • Reduce the amount of international transic bandwidth consumed and the volume of traffic in the regional backhaul by between 30% and 80% (depending on the type of traffic cached and how well the platform can be optimised) - this means OPEX cost savings for you.
  • Reduce the need to invest in infrastructure to cope with the rise in traffic, which translates into CAPEX savings
  • Improve the response times for your customers (end-users), enhancing their experience and their satisfaction
  • Gain a better understanding of what is happening on your network, and what your customers are doing
  • Create new revenue streams by offering a content filtering service to your customers or by using your cache to become a delivery partner for the SwiftServe CDN service

These significant benefits ensure you of a faster, safer and better ROI, making the investment in SwiftCache a very low risk option with a significant upside.


Reference:
1. SwiftCache

Microsoft: Bulk Active Directory ( AD ) Account Creation

Follow the steps below for the bulk AD account creation:

1. Create a CSV file in Excel with the following columns: -
    a. FirstName
    b. LastName
    c. SamAccountName
    d. Description
    e. Password
    f. Department

2. Save the CSV file as test.csv

3. Run the following powershell command after changing the bold statement in your AD server: -

Import-Csv C:\test.csv | foreach-object {
$userprinicpalname = $_.SamAccountName + "@domain"
$name = $_.FirstName + " " + $_.LastName
New-ADUser -SamAccountName $_.SamAccountName -UserPrincipalName $userprinicpalname -DisplayName $name -Name $name -GivenName $_.FirstName -SurName $_.LastName -Path "OU=Users,OU=UK,DC=domain" -AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force) -Enabled $True -Department $_.Department -Description $_.Description -Manager $_.Manager -PasswordNeverExpires $True -ChangePasswordAtLogon $False -PassThru
Add-ADPrincipalGroupMembership -identity $_.SamAccountName -memberof "member1","member2","member3"}

Microsoft: Bulk Folder / File / NTFS Permission Configuration

In order for bulk folder / file / ntfs permission configuration, you may use the ICACLS command.

Syntax: -
icacls <FileName> [/grant[:r] <Sid>:<Perm>[...]] [/deny <Sid>:<Perm>[...]] [/remove[:g|:d]] <Sid>[...]] [/t] [/c] [/l] [/q] [/setintegritylevel <Level>:<Policy>[...]]

icacls <Directory> [/substitute <SidOld> <SidNew> [...]] [/restore <ACLfile> [/c] [/l] [/q]]

Parameter: -

Example: - 
1. Full Control
icacls C:\test\subtest /grant Domain\user1:(OI)(CI)F

2. Special permission
icacls C:\test\subtest /grant Domain\user1:(OI)(CI)(M,DC)

NetApp: Bulk Quota Setting

Follow the steps below for bulk quota setting:

1. Go to //<filer>/c$/etc/quotas
2. Open the quotas file in WordPad
3. Add the following command: -

    /vol/<volume1>/<username1> tree <quota1> - - - -
    /vol/<volume2>/<username2> tree <quota2> - - - -
    /vol/<volume3>/<username3> tree <quota3> - - - -
    .
    .
    .
< continue until the last quota that you would like to set >

Example: -
     /vol/vol_nfs_test_01/user1 tree 2097152K - - - -
     /vol/vol_nfs_test_02/user2 tree 5126152K - - - -
     /vol/vol_nfs_test_03/user3 tree 2567152K - - - -
    .
    .
    .
     /vol/vol_nfs_test_50/user50 tree 2097152K - - - -

4. Leave a blank paragraph at the end of your last command line
5. Save the quotas file

NetApp: Bulk QTree Creation

Follow the steps below for bulk QTree creation:

1.  Log on to your NetApp CLI ( Command Line Interface )
2. Type in the following command for bulk QTree creation: -

    qtree create /vol/<volume1>/<username1>
    qtree create /vol/<volume2>/<username2>
    qtree create /vol/<volume3>/<username3>
    .
    .
    .
    < continue this command until the last QTree that you would like to create >

Tuesday, 13 August 2013

Microsoft: WiseSoft Bulk AD Users

WiseSoft Bulk AD Users is a tool that makes it easy to perform bulk updates to Active Directory User account attributes. Previously you might have wrote scripts to perform these types of updates or gone through a very tedious process of performing these updates one at a time via the ADU&C interface. Bulk AD Users makes this process much simpler and also provides an XML log file that allows you to undo any unwanted updates. The application includes powerful query capabilities and has a number of different ways to allow you to update user account data. e.g. Update From CSV, Edit In Excel, Edit In Grid, Bulk Modify (Similar to the User dialog in ADU&C, but it works on any number of user accounts).




Reference:
Bulk AD Users

Microsoft: Fine Grain Password Policy Tool

With Windows Server 2008, administrators can now apply password policies at layers lower than “the domain”. These “fine-grained password policies” allow for applying different restrictions for password and account lockout policies for different users in a domain.

Christoffer Andersson developed the Fine-Grained Password Policy Tool which extends the capabilities of the GPMC and adds PowerShell scripting capabilities for easy administration of these new policies.

I helped make the Active Directory Domain Services API wrapper as well as deployment project compliant with the 64-bit Windows Server platform. Björn Österman also contributed to the development of the application.




Reference: