Programming, Solution

VBScript: Folder Monitoring

Hi,

There’s a scenario where there’s an active folder where files are coming in and out, so the key objective of the program is to ensure that the folder always stay empty. Any files that stay more that 30 minutes is consider an alert and it needs to be taken care of and the alert will be sent through email.

So below are the code and it is triggered every 15 minutes using the Task Scheduler :

Note: The Outlook application has to be running, otherwise it will go to the outbox folder and the mail will be sent after the outlook application is running


age_threshold = 30 'in minutes

folderPath = "path"

Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.getFolder(folderPath )

file_found = 0

Set shell = wscript.CreateObject("Shell.Application")

For Each fl in fldr.Files
age = DateDiff("n", fl .DateCreated, Now)
If age > age_threshold Then
file_found = file_found+1
End If
Next
if file_found > 0 then
sendAlert(file_found)
WScript.Quit()
else
WScript.Quit()
end if

sub sendAlert(no)
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
objMail.Display 'To display message
objMail.To = "xyz@xyz.com"
objMail.Subject = "Alert: Folder XYZ"
objMail.Body = "Please check the XYZ folder - "&folderPath
objMail.Send
Set objMail = Nothing
Set objOutlook = Nothing
end sub

-Farrah K.

Programming, Solution

VBScript: Content Search

Hi,

I used to write codes in Visual Basics, it was long time ago. Never thought that I will use it again until recently with my current job which using VBScript. For my understanding is that VB is more to application while VBS is more to script language that runs command, more like a batch file. In another word, VBS is the light version of VB. (in a sense haha)

For the first time, I was given a sample before I write it then after writing it I quite surprise VBS can do a lot with the files which I have been doing it manually years ago when I was in my uni. Some of the things that I wish I knew it back then so I could just write it and let the task scheduler do the works haha.

OK, so one of the tasks that have given to me was to search for numbers among 100-500++ files. So what I did was I wrote the code below which I called it “smart lookup” hehe… Below are just the small chunk of it but definitely a keeper:

num= InputBox("Please enter the number","Look for")
Set result Set fldr = fso.GetFolder(folderpath)
Set fls = fldr.Files
Set d=CreateObject("Scripting.Dictionary")
n=1

For Each fl In fls
Set r= fl.OpenAsTextStream(1)
content = r.ReadAll
if instr(1,content,num) then
d.Add "a" & n, fl.name
n=n+1
end if
r.close


Next
allRslt=d.Items
counter=d.Count

set w= result.CreateTextFile("result.txt") 'put all the result into this file, just in case it appears in multiple files
if counter>0 then
For i=0 to counter-1
w.WriteLine allRslt(i)
Next
end if
w.close

So this is just one of it that I’ve done and it’s quite handy.. Next post I’ll share you another task using VBScript

-Farrah K.

Installation, Solution

SharePoint 2016 Prerequisite installation error

So trying out the SharePoint 2016, while installing the prerequisite I’ve encountered that it was unable to install the Microsoft Information Protection and Control Client 2.1 as shown below:

sp error

So I went through the web and found this link: https://www.microsoft.com/en-us/download/details.aspx?id=38396

Just download it, install and run the prerequisite again

Then another error I have encountered was that it unable to install the .NET Framework 4.6

So here’s the link: – make sure your windows updates are updated

https://www.microsoft.com/en-us/download/details.aspx?id=42334

And re-run again the SharePoint prerequisite.

That’s it for me.

-Farrah K.

Networking, Solution

How to turn a router to a repeater?

Hi All,

I have received a new challenge recently where I have an unused router and I were asked to make it act as a repeater. Some of the router has the repeater functionality but not this one that’s with me which is the Linksys WRT54G v5.0.

DD-WRT is a Linux based alternative OpenSource firmware suitable for a great variety of WLAN routers and embedded systems. The main emphasis lies on providing the easiest possible handling while at the same time supporting a great number of functionalities within the framework of the respective hardware platform used.

“Nothing is impossible” (Lucky me~), here  are the list of devices that support DD-WRT. Below are the steps for flashing the router to become a repeater.

Note: You’ll need the router to be connected to the computer using the Ethernet cable and also a timer/stopwatch.

  1. Download the zipped files in GV5Flash.zip
  2. Do a hard reset on the router, 30-30-30 reset:
    • Push the reset button with the router powered on.
    • Hold it for 30 seconds with the router powered on.
    • Still holding it, pull the power cord for 30 seconds.
    • Still holding it, plug the power back into the router
    • Continue to hold the reset button for 30 more seconds.
    • Full 90 seconds without releasing the reset button.
  3. Set a static IP on the computer to 192.168.1.7 and Subnet mask to 255.255.255.0.
  4. Turn off the wireless connection and firewall. Only connect the computer to the router using the Ethernet cable.
  5. Unzip the GV5Flash.zip
  6. Unzip the VXImgToolGui.zip and run VXImgToolGui.exe
  7. Select the WRT54G not WRT54GS
  8. Put the MAC address which can be seen at the bottom of the router
  9. For the output image, save it as My54gImage.bin in the same extracted folder
  10. Power cycle the router by unplug the power from the router for 30 seconds and then plug it back in.
  11. Go to the internet browser and type 192.168.1.1. Linksys page will be shown and not the Management Mode page. If it shows management mode then power cycle the router again.
  12. Enter “root” as the username and “admin” as the password.
  13. Go to Administration and Firmware Upgrade.
  14. Navigate to the extracted folder, and select vxworks_prep_03.bin.
  15. Hit upgrade.
  16. Wait for FIVE FULL MINUTES. DO NOT turn off or disconnect the router.
  17. Once it is passed, do a power cycle on the router.
  18. Browse again to 192.168.1.1. If it shows a blank window, clear the browser cache. and it should be showing the MANAGEMENT MODE window.
  19. Select the My54gImage.bin and hit Apply.
  20. Wait for the “Upgrade Success” message, and then WAIT FIVE FULL MINUTES again. DO NOT turn off or disconnect the router.
  21. Start tftp.exe.
    1. Enter 192.168.1.1 as the address in the top box of tftp.exe.
    2. Leave the password blank.
    3. Select the 12548 Newd_Micro.bin firmware.
    4. Set retries to 99.
    5. Power cycle the router.
    6. Count to 2.
    7. Hit upgrade.
  22. When it is success, wait FIVE FULL minutes.
  23. If it is not success, repeat from steps 21(4) up to this one. If it is still not success, clear your browser cache. Try using a different browser as well, to navigate to 192.168.1.1.
  24. When dd-wrt page can be accessed using a browser at 192.168.1.1, power cycle the router.
  25. When it can be accessed again the dd-wrt page using a browser at 192.168.1.1, do another HARD reset (refer to steps 2) on the router.
  26. Reset the computer Ethernet connection to auto IP and auto DNS.

So that’s how to flash the router. Once it is done, then you can set the wireless mode to the repeater.

That’s it!…


-Farrah K.

Misc, Solution

CRM: Quick adding Entity

In this post, it is about how to quick add an entity into the CRM with populated data.

Here are the steps:

  • Go to Setting > Data Management.

Capture

  • Click on Imports.
  • Just below the top navigators click on IMPORT DATA.

 Capture

  • For this post I used this  file.
  • Browse the file, click Next and wait for the file to be imported.
  • And click Next.
  • On the Select Data Map, select Default (Automatic Mapping) under System Data Maps and click Next.

Capture

  • On the Map Record Types, select Create New under Microsoft Dynamics CRM Record Types.
  • Then fill in the field as shown below, and click OK

Capture

  • Once it is successfully mapped, click Next.
  • On the Map Fields, under Required Fields I select Name since I make it as my Primary Field.
  • As for Optional Fields,
    • for Capital: select Create New Field under Actions and set Type: Single Line of Text.
    • for Continent: select Create New Field under Actions and set Type: Option Set.
  • Click Next until you press Submit.
  • It may takes some time but it will come.
  • Once it is finished. Keep refresh until the Status Reason is Completed.

Capture


  • Next, go to Settings > CustomizationsCapture
  • Click on Customize the System
  • Expand the Entities and look for Country
  • Check on the areas that you want to display this entity, for this post I select Settings.
  • Then Save and Publish

Entity View

  • Expand the Country and click on Views.
  • Next to the File, click on the Publish All Customizations.
  • After it is done, double click on the Active Countries, and add/remove the columns that you would like the view to display.
  • Save and Close.
  • Make sure you click on Publish All Customizations.

Entity Form

  • Expand the Country and click on Form.
  • Just drag and drop the fields that you would want to display it on the form
  • Once done, click on Save then Publish under the Home tab

  • Refresh the CRM and you’ll see the entity on the area you have selected and published early

That’s it…

-Farrah K.

Programming, Solution

GitHub Introduction

Git is an open-source version control system.

Hub is where developers can store and share their projects.

GitHub is ideal for programmers may have you believing that they are the only ones who will find it useful. Although it’s a lot less common, GitHub can actually be used for any types of files – so if you have a team that is constantly making changes to a word document, you can actually use GitHub as your version control system.

To setup a GitHub account is easy however as for me the managing part at first is a bit complicated but I figure out how and finds it easy.

After you opened a GitHub account, it is recommended for you to install GitHub on your desktop (Windows). Just go to Here

Once it is installed, there are 2 applications: GitHub and Git Shell.

In order to use the Git Shell, it is best if you know the basic commands of Linux like rm, mkdir, mv, ls, etc. But no worry there are always plenty of sites that you can refer to. I usually refer Here

As for GitHub, it is easy to use and any changes made to the files or folder will be updated and you will have to commit and then sync with your GitHub online. Furthermore, if you write codes using Visual Studio you can also link it with your GitHub.

What you do is:

  1. Open up Visual Studio, I’m using Visual Studio 2015.
  2. On the menu tab, go to Tools > Extensions and Updates…
  3. On the side menu, go to Online and search for GitHub.
  4. Look for GitHub Extension for Visual Studio, download and install.
  5. Restart the application.
  6. So after you create a new project, on the menu bar go to File > Add Source Control.
  7. Select Git.
  8. If you want to use it for the rest of the new project then check the check box otherwise just let it be unchecked.
  9. Go to the Team Explorer tab on the right side of the application:
    Capture
  10. Go to Settings, and check if everything is correct
  11. Click the icon that look like a plug  Capture
  12. Then click connect under GitHub and log in with your username and password
  13. Under the GitHub, you may or may not want to clone from your GitHub, if you do then just copy the link from your GitHub: HTTPS clone URL. Otherwise, just create a new Repository.
  14. So whenever you are ready to update your GitHub, you will need to click on Changes > Enter a message and click Commit
  15. After commit is done then you have to sync by going to the Sync
  16. Then the GitHub will be updated.

You may find it a bit hard to follow for few days but you’ll get there. If you need help just write a comment and I try my best to help you.


Nothing much yet on my GitHub as I just started to use it but feel free to visit 😀

My GitHub: Here

-Farrah K.

Installation, Solution

CRM installation error

Hi All,

During my CRM installation I have encountered this error:
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MSCRM_CONFIG.mdf".

So I look up on the net and found this solution:

  • Stop MSSQLSERVER services
  • Go to “C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA” and delete MSCRM_CONFIG.mdf and MSCRM_CONFIG_log.ldf
  • Start MSSQLSERVER services
  • Then re-run the installation.

It works!

Farrah K.