Category Archives: Automation

Windows: cwRsync to replicate data from source to target

Published / by Chen Ye / Leave a Comment

 

Today since the network restriction policies, I can’t map a network drive from a Windows client via SMB protocol to copy my file to a Linux host. It really worries me a lot to build up my project.

There is an ideal come across my mind and I timely captured it. How about using a classical way in Nix environment to rsync to replicate data from source to target.

Benefits are obviously seen:

  1. Only Modified contents are replicated
  2. The tunnel between two hosts are encrypted using OpenSSL key infrastructure.
  3. I can run a scheduler to periodically run to sync the contents.

So I do the following things to set it up:

Continue reading

PowerShell: Image-downloader improved and function reuse version

Published / by Chen Ye / Leave a Comment

 

Another improvement makes to the Image-downloader code.

  • Introduced function “Inputchecker” to validate user input
    • vaguely match the strings user inputs and try to match with the strings, if not match ask the user to re-type the number
    • precisely matching the version number user input using regex
    • separately handling onefs and insightiq image name and url path
    • get the list of filename from URL path and dump to help the user choose insightiq version to download

Continue reading

WinSCP: Automated Tiering data from Windows Machine to a Remote Server

Published / by Chen Ye / 1 Comment on WinSCP: Automated Tiering data from Windows Machine to a Remote Server

 

By virtual of the file transferring tool ‘WinSCP'[download link], we can schedule a task to tier a specified directory path to a remote server directory server path automatically and periodically.

The magic is it frees your hand to do the duplicated steps day by day, for example manually uploading files steps by steps to log server with slow speed. With the help of the automated script, it will run at background without manual intervention.

So cooool!!!

In this section, I only refer how to set schedule in the recent Windows version, you could access to the official website to know other Windows versions or other platforms:

###https://winscp.net/eng/docs/guide_schedule

Continue reading

PowerShell: Image-uploader

Published / by Chen Ye / 1 Comment on PowerShell: Image-uploader

 

Today continue to share with you the automated scripts to upload ovf image to Vcenter

I implemented this function and sub-function using  the following scripts(although there are some duplicate functions call, this will be improved using the same function calls across the entire scripts ):

  1. Using condition to avoid repeatedly calling and loading VMware modules, using condition to avoid repeatedly inputting the Vcenter host, username and password settings, using condition to escape related condition. Know how to add more conditions to “if-else” sentence to determine whether or not to execute the related scripts
  2. [string]::IsNullOrWhitespace($Datastore) to determine whether string is null or contains whitespace
  3. Using Powershell built-in Import-VApp, Get-VMHost to upload ovf to VCenter server or get related information

Continue reading

PowerShell: Image-downloader

Published / by Chen Ye / Leave a Comment

 

Wget in Nix world is well knows, it is really convenient to download files to your local path.

Today, when I am considering using another tool in Windows World to download the file from the normalized URL, I also found a tool called “system.net.webclient”. It is quite useful but to my option not as sharp as wget though:

Three implementations were carried out:

1.Download the file

2.Unzip the file to specified directory

3.Convert ova file format to ovf

4. Learn to introduce an indirect variable to import the one of array value to it each time

It will really save me a lot of time when doing testing and deploy OVF to Vcenter server:

Now I will share with you my labor, to some extent, hope it will be helpful for you 🙂

Continue reading