Skip to main content

Posts

How to use System Restore to Remove Viruses

On Windows XP, Vista and Windows 7 machines, there is a feature called System Restore. It’s normally enabled by default and takes snapshots of your system files and registry settings. I have used it on several occasions to repair a machine that had a virus/malware infection. It can be very difficult to repair a virus or malware because as soon as the computer starts up, the virus gets loaded into memory and depending on the virus, it can prevent your attempts at removing it. Luckily the viruses that I saw were not too harmful. It’s only just annoying. You can try the following steps. First shutdown your computer. Turn on the computer again but start it up in Safe Mode. To get into safe mode, you need to press the F8 key so it can display a list of startup options. This can be tricky so I usually hit the F8 key as soon as the computer starts and just keep hitting it until the startup options come up. Select  Safe mode  from the list. Once you have started the computer in...

Powershell Script to Test if a Host is Up or Down

Description Sometimes it is necessary to do a ping test to find out if there are dropped packets. It is not practical to keep watch on the continuous ping test overnight. I wrote a little PowerShell script to make use of the Test-Connection cmdlet. It writes to a log file the change in network status. I didn't want it to record every ping responses. Basically it will record the date and time initially of the network status of a host. Then when there's a change in status, it will record the date and time and the state of the host i.e. UP or DOWN. From the logs, you can see if there had been dropped packets by looking at the change in status. The Code is below : ## Get current date and time $currentdate = get-date $count = 1 $myHost = "10.0.1.1" $maximumcount = 10 $networkstatus = 0    # 0 = up and 1 = down $outputfile = "C:\PowerShell\ pinglog.txt" # Do the initial ping test $currentdate = get-date $pingResponse = Test-Connec...

PowerShell Script to Check If Files Have Stopped Coming in

Introduction I am currently working in an environment where database backup files are generated on production servers and it gets replicated across to another data centre. The replication is done via a scheduled task in Windows Task Scheduler. The scheduled task merely runs the robocopy command with the appropriate parameters. Detecting if the Files Have Stopped Replicating One of the things I've learnt all these years is that if you forget to check if something is working, it ends up being that that's when it stops working. I have created a PowerShell script which will read a text file containing a list of folders it needs to check to determine if the latest backup files have come in or not. It will send an e-mail to the appropriate administrators. You can modify the PowerShell script to meet your needs, but I will use it as a way to demonstrate PowerShell programming. DISCLAIMER: It is NOT implied that it will work in your environment and that it will suit y...

Downloading the latest PowerShell 5.1

To begin our tutorial on PowerShell, let's download the latest version of PowerShell. Microsoft has recently released PowerShell 5.1 (19th January 2017) . It is packaged with the Windows Management Framework 5.1. You can find this version by Googling or Binging "PowerShell 5.1". Just check the link that comes up is a Microsoft link before you click it. Otherwise, here is the link for Windows Management Framework 5.1 : https://www.microsoft.com/en-us/download/details.aspx?id=54616

Learning Windows PowerShell Scripting

Introduction For many years I've been scripting using DOS Batch scripts. In the last few years I had also used VBScript.  I've never really got into PowerShell scripting. It just seemed so complicated with so many commands to learn. Recently I have forced myself to use PowerShell instead of DOS Batch scripts or VBScripts. It supports your typical programming style flow controls and variables. But there are so many commands or cmdlets ( in PowerShell terminology ) to learn. That's just on a standard Windows Server. If you are running PowerShell on an Exchange server, there will be Exchange server specific cmdlets on top of that. If you are running on Sharepoint, there will be Sharepoint specific cmdlets on top of that... and so on. For a beginner, let's first look at what we want to do, and see if we can find the cmdlets to help us achieve this. The tutorials will be based on learning PowerShell through writing scripts based on tasks that a system administr...

Hyper-V - Failover Cluster, Quick Migration and Live Migration

If you are like me and have mainly worked in small businesses then you may not have had the chance to setup a failover clustering environment. We've read all about it and how wonderful it is to have it, but unfortunately a lot of the times, the money is spent on more important things like staff salary and trying to keep the business afloat. Well, I am happy to say with the client I am working for right now, they have a very good failover clustering Hyper-V environment running on top of Windows Server 2012 R2  Datacentre attached to an EMC VNX 5300 SAN. The guy who set it up unfortunately no longer works there. To cut a long story short, I needed to move a VM to another node (another host in the cluster). With failover clustering being used for Hyper-V you need to run the Failover Cluster Manager to manage the VMs. You don't use the Hyper-V Manager, even though you can start it up and see the virtual machines. You can change some settings with Hyper-V Manager, but the reco...

What is The Network Administrator Survival Kit ?

The Network Administrator Survival Kit (NAS Kit) was conceived many years ago when I was a network administrator. It contained information such as troubleshooting procedures, tricks and tips. It was written in HTML and sits on a network share. My colleagues access it via a browser and only two of us who knew HTML was able to modify it. It was so useful because the information was specific to our organisation. No more re-inventing the wheel. The first thing we would do if we can't figure out the solution is to check out the NAS Kit. If we can't find the solution there, we would obviously research until we are able to resolve the issue. The next entry in the NAS Kit would be the steps that we have just used. Over the years, I have also found it so useful that there are so many sites across the web that are providing information that have helped me so often in my job. So now, here's a chance for me to pay it back. With 24 years of experience in IT ranging from desktop ...