Advertisements

Monthly Archives: March 2015

Powershell – Get the First and Last Day of the Month

You could do this in different ways with powershell. But the whole idea is to keep it simple

$CURRENTDATE=GET-DATE -Format "MM/dd/yyyy"
$FIRSTDAYOFMONTH=GET-DATE $CURRENTDATE -Day 1
$LASTDAYOFMONTH=GET-DATE $FIRSTDAYOFMONTH.AddMonths(1).AddSeconds(-1)

$FIRSTDAYOFMONTH
$LASTDAYOFMONTH
Advertisements

Have to type single/double quotes twice for them to appear

Quotes, Tilde and Caret Symbol appears only when clicked twice

If you are faced with the above error, it is most likely that you are using US International as your Keyboard Layout

Screen Shot from Window 8.1

  • Control Panel – Language

US_International

  • Click Options to change the Keyboard Input

us_international_input_method

  • Click Add an input method and select US / US English
  • Remove the US International entry and Save

Send-MailMessage – Send Mail with multiple attachments

Powershell – Send Multiple Email Attachments using Send-MailMessage

Pass each attachment location to a variable and add this to the Attachments parameter separated by comma

Example

$Att1="c:\test1.csv"
$Att2="c:\test1.csv"
Send-MailMessage -To abc@tkr.com - From xyz@tkr.com -Subject "Attachments" -Attachments $Att1,$Att2

Backup Exchange Server 2013 with Windows Server Backup

Files to be backed up on Exchange Server 2013

  • Database File (*.edb)
  • Transaction Log Files (*.log)
  • Checkpoint file (*.chk)

More details on these files can be found on this LINK

Install Windows Server Backup on your Windows Server 2012

  • From Server Manager – Select Add Roles and Features
  • Under Features, select Windows Server Backup as illustrated below

 

windowsserverbackup

  • Once Installed – Open the Windows Server Backup utility

windows_server_backup

  • Select Backup Schedule / Backup Once as per your requirement
  • Select destination type as per your setup

destination

  • Since you are aware which files are required to be backed up, you can choose the custom option to manually select the files you require to backup

backup_schedule

  • Select the backup type as per your current settings

vssbackup

  • If you are not using any other tools for backup of the Exchange; select VSS Full Backup to ensure the log files are purged after the backup is completed

Once the backup completes, click View Details to verify the backup is done properly

view_details_windows_server_backup

 

In addition to this run below command from Exchange Management Shell to verify the backup

Get-MailboxDatabase -Server Servername -Status | select name,last*backup

The Columns for Last Full Backup should show the updated date

Robocopy and the many ways to use it!

Powerful File Management with Robocopy

Robocopy is a utility developed my Microsoft to enable copying higher volumes of data (in GB’s and TB’s) from one location (on a server/workstation) to another (server/workstation). The normal copying may not do the job for us as they do keep getting interrupted with pop ups on whether or not to copy a certain file/files. With Robocopy, this issue can be overlooked at. When I first used robocopy, I wasn’t too sure about how the commands would be like. However the robocopy commands are simple and can be used on a simple command prompt or even on Windows Power Shell! I particularly found this website very helpful with the different attributes or options we could add to the robocopy command. The normal usage of robocopy is ROBOCOPY Source_folder Destination_folder [files_to_copy] [options] The various [options] that can be used along with the robocopy command are available in the link provided above. Now there may be many of them like me who wouldn’t want to type in a lot of commands and instead use a GUI. Well, this is possible too. Thanks to a few good souls at Microsoft this is now possible. These applications Robocopy GUI and RichCopy were developed in 2006 and 2009 respectively. One can download them and try to use them with whatever options he/she requires. For my case I used Robocopy GUI as I was quite comfortable with it because of it’s simple GUI. But beware! To install these applications on Windows OS’s like Windows 7, Windows 8 or 8.1, Windows Server 2008R2, 2012, 2012R2 one may need to install the older .NetFramework versions. I had encountered such an issue while installing Robocopy GUI on Windows Server 2012R2. So go on, try this utility and see how helpful it is. The transfer rate is properly controlled and there were no interruptions or pop ups waiting for the user to acknowledge.

Backup Remote Agent (Backup Exec 2014) installation failing due to “Microsoft VC++ Redistributables (x64) installation failed” error.

We happened to upgrade our Symantec Backup Exec 2010R3 to Symantec Backup Exec 2014 recently. Although the GUI was quite straight forward with the older one, the new one’s GUI looked quite confusing at the start. But after exploring a bit, it looked an animal that could be tamed. The first job that we ran failed. Although the backup was done, the remote agents had caused a failure of the job itself. When I tried pushing the agent updates from the main backup server, the upgrades failed. I then realized that I may have to do this manually.

From Symantec websites I had figured out how to do the installation manually. You may go to the link and look for the section “Local (manual) installation using the GUI method”. But this story didn’t end ever so happily! Upon doing the installation manually, it failed. It failed with an error “Microsoft VC++ Redistributables (x64) installation failed”. Just when I thought that the whole world crashed upon me, I figured out from another blog to bypass this.

While the link above suggests that we copy the RASW32 or RAWSX64 folder, it doesn’t say anywhere to copy the “VCRedist” folder too! This is the hidden trick. So to summarise, my steps where as follows:

  1. Copy the RAWS32 or RAWSX64 folder and the VCRedist folder together to a location on the remote server. It could also be the Desktop of the user.
  2. Run the setup as was described in the link that was posted above.
  3. The error should not appear after this. I didn’t face any error after this.

Please do bear in mind that the servers may require a restart if the installation is being done with the old remote agent still installed! Even if an old agent doesn’t reside and the installation is done, it is always recommended to restart the server after the installation.

Windows cannot be installed to this disk. This computer’s hardware may not support booting to this disk. Ensure the disk’s controller is enabled in the computers BIOS menu

Unable to Install Windows 7 to Disk

If you encountered above error when installing an Operating System on your PC; use below solution

  • Restart your system and get into BIOS
  • Change the Boot Mode/Priority from Legacy to AHCI or UEFI
  • Save the BIOS Settings
  • Retry the installation and it will work as intended

 

Manage Storage of IIS Log Files – Scheduled Deletion of IIS Logs

Drive Space Full with IIS Log Files / Reclaim Disk Space

Are your Local Drives of your IIS Server running out of space? Have you checked the size of your IIS Logs?

If your IIS was setup by a professional; you would not have to go through this issue. The log files would have been managed appropriately

Ideally I do not see a purpose to keep IIS Log files beyond a period of 1 month. Those older than one month should ideally be removed to prevent disk space issues

I found below posts which will assist you. Before you use the below scripts; please identify the location of your log files

Using Powershell

http://www.codeproject.com/Articles/663000/Simple-Powershell-script-to-clean-up-IIS-log-files

Using VBScript

http://www.iis.net/learn/manage/provisioning-and-managing-iis/managing-iis-log-file-storage#02

By default; you would find them on C:\inetpub\logs\LogFiles\

To verify the location; open IIS and select the Default Website and click Logging

IIS_Screenshot

Take note of the path mentioned in the directory field

IIS_Logging

Downloads all attachments from an Email Account

I came up with this requirement recently where I had to download more than 1000 attachments from a Gmail Account across multiple emails. I was hoping there would be some script to achieve this.

I stumbled upon this fantastic tool and I got my task done in just few minutes

Mail Attachment Downloader from GearMe

This tool is free for Personal and non-commercial use

The software is pretty much self-explanatory. The best part is the option to filter through the mails to ensure only the required attachments are downloaded

  • Enter your Email Address / Password
  • Define the Save Location for the downloaded attachments
  • Use the Folder/Files , Basic and Advanced Filters to customize your requirement
  • Once all requirements are defined click Connect and Download
  • Sit back and relax till the downloading is done

 

mail_downloader_pro_01

 

HP Printer: Invalid Input Click ok to go back

Applies to HP Printers : Unable to change IP Address from Dynamic to Static

When manually changing the IP Address of the Printer from the Printers Web Console from Internet Explorer; you may encounter the below error.

InvalidInput

Please note that this error is only specific to Internet Explorer. If you are not really keen on solving the issue from Internet Explorer; use the first solution below

Solution 1

  • Use Chrome or FireFox Instead

Solution 2

  • From the Internet Explorer Menu select – Tools – Internet Options – Local Internet – Sites – Advanced
  • Type the current IP Address of the printer and click ADD
  • Also Type the new IP Address of the printer you wish to change to and click ADD
  • Close and open Internet Explorer
  • Browse to the Printer Web Console and change the IP Address as intended