How to ping to a file and with a timestamp

How to ping to a file and with a timestamp

Have you ever had the need to ping to a file but also know when the pings happened so you can analyze the data better. Here is on example :

Open Notepad and input the following :

@ECHO OFF
:LOOPSTART
echo %time% >> ping.txt
echo %time%
ping 172.17.10.11 -n 10 >> ping.txt
GOTO LOOPSTART

Change the IP Address to the desired one and also change the name of the output file if needed ( currently it is ping.txt ). It will be created in the directory from which you are running the batch file. Also note that the current batch file will do the ping infinitely. If you want to change that remove the “-n”. The number 10 specifies how many pings it will do before timestamping and starting on the new roll.

Now save the Notepad file as ping.bat ( or a different name ) and run it. The output should look like that :

You can also download a sample batch file and edit it for your own needs. Click here.

16:00:15,91

Pinging 172.17.10.11 with 32 bytes of data:
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128

Ping statistics for 172.17.10.11:
Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
16:00:24,98

Pinging 172.17.10.11 with 32 bytes of data:
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128

Ping statistics for 172.17.10.11:
Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
16:00:34,01

Pinging 172.17.10.11 with 32 bytes of data:
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128
Reply from 172.17.10.11: bytes=32 time<1ms TTL=128

 

Moving or Deleting the SBS Monitoring database in SBS 2008

Moving or Deleting the SBS Monitoring database in SBS 2008

By default the SBS Monitoring database resides under

C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data

which can grow to more than 4GB of size. This can cause disk space problems on the server and there is no particular need of it to be on the system drive. Here are the steps to move it to another partition.

sbsmonitoring-database-location

Stop any backup you may be running in SBS 2008

  1. Now navigate to C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data
  2. Open the SQL Server Management Studio Express and connect to the SBSMonitoring database.SERVER\SBSMONITORINGsbsmonitoring-connection
  3. Now we have a couple of options based on what we want to do
    1. If we want to flush the database and start with a clean one of a normal size you can delete the SBSMonitoring.mdf and SBSMonitoring_Log.Ldf files. After they are deleted we need to replace them with the same database files but files but emptied. You can download them from here. This is all you need to do and can move to step 6.
    2. If we want to move the database to another partition and still use it, now that you have stopped both of the services mentioned above. Move the SBSMonitoring.mdf and SBSMonitoring_Log.Ldf  files to another partition.

Right click the database -> Tasks -> Detach. Click Ok to detach the database. If you receive this error : Msg 3701, Level 16, State 1, ServerName\SBSMonitoring, Line 1
Cannot detach the database ‘SBSMonitoring’ because it is currently in use.

Go to Services again and restart the SQL ( SBSMONITORING ) service. Click Ok and the database should detach now. Right click the Databases folder now and click Attach. On Databases to attach : click Add and browse to the new location of the database. You can now proceed to step 6.

  1. Now go back and restart/start the SQL Server ( SBSMONITORING ) service and Windows SBS Manager service

Checks ! You can always check if the changes you just did are working. Generate a report, email it  and see if everything works fine. If not use the following guide.

http://blogs.technet.com/b/sbs/archive/2009/07/14/sbs-2008-console-may-take-too-long-to-display-alerts-and-security-statuses-display-not-available-or-crash.aspx

Setup mail relay in Exchange 2003/2007/2010

Setup mail relay in Exchange 2003/2007/2010

At some point in your IT lives you will find yourself in the position to configure mail relay, for a device or a server in your local network. Here’s how it’s done :

Exchange 2003 :

Exchange Console -> Administrative Groups -> first administrative group -> Servers -> Servername -> Protocols -> SMTP -> Right click Properties on the Default SMTP Virtual Server -> Access tab – Relay. Click Add and insert the IP address of the device you that want to relay through your Exchange.

relay 2003

Exchange 2007/2010:

Not easy to guess if you don’t know – It is done through the use of a Receive Connector.

Go to Exchange Management Console – > Hub Transport -> Receive Connectors. Right Click and choose New Receive Connector.

Choose an appropriate name for it. For intended use choose Custom.

For Local Network Settings, leave it as it is. on Specify the FQDN type in your Fully Qualified Domain Name of your server. Example . Exchangeserver.contoso.local

On the Remote Network Settings, delete the entry 0.0.0.0-255.255.255.255 and add on your own. Input the IP address of the device that you want to relay through the Exchange server.

Click New. This will create the Connector but our job is not yet done. Right click the Connector and go to Properties. On the Authentication tab choose Externally Secured. On the permissions tab leave blank.

Open Exchange Shell. Type the following command:

The only change in the command you need to make is to put the real Connector’s name in the brackets.

Get-ReceiveConnector -Identity “Connector’s Name” | Add-ADPermission -User “NT AUTHORITY\ANONYMOUS LOGON” -ExtendedRights “ms-Exch-SMTP-Accept-Any-Recipient”

Depending on specifics around the relay you may need to specify Exchange Users as Permissions group.

Can’t remove additional mailboxes in Outlook

Can’t remove additional mailboxes in Outlook

Have you ever wondered why you can’t close down your additional mailboxes in Outlook, returning you this error :

Can't remove additional mailbox from Outlook

Only to find out that your Account Settings tab is empty?

Can't remove additional mailbox from Outlook

Well there is still hope. There are two options. You can just re-create the Outlook profile and hope that this fixes it or you can choose to explore more options. One of these options is called Auto Mapping and is introduced in Exchange 2010 and 2013.

It basically automatically adds any mailboxes you have Full Access to directly into your Outlook client. This is designed to reduce the administrative time to give such access especially for helpdesk teams where a single click can provide you with Full Access but you need still to do a remote session to the customer’s computer and add the mailbox into their Outlook.This is for the customers that don’t know how to do it themselves and believe me 90% of them don’t.

However touching the automapping cannot be done through the GUI and would need Shell. Here is the command :

Add-MailboxPermission -Identity User1 -user “User2” -AccessRights FullAccess -InheritanceType All -AutoMapping:$false

where User 1 is the mailbox owner and User 2 is the user receiving the FullAccess rights to User1’s mailbox. -AutoMapping:$false or true turns off and on the automapping.

Can't remove additional mailbox from Outlook

Don’t worry if you run the command for users that already have Full Access to their mailboxes, it will still run the command properly.

For those of you who want to go even further here are the registry keys responsible for the Outlook profiles. Always backup your registry before editing !

HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Default