Wednesday, November 29, 2017

GitHub Desktop for other providers

GitHub Desktop can be downloaded from GitHub Desktop.
It is provided by GitHub and supposed to use only for GitHub.com
Other providers like BitBucket can’t be used directly with GitHub Desktop.
If we need desktop client for BitBucket, we can use directly the Git software available at Git website, this is the most recommended one and have both command line and GUI versions.
But for people, who are acquainted with GitHub Desktop, they can follow below instructions to use BitBucket and other service providers with GitHub Desktop.
  1. Clone the Bitbucket repo locally via command line.
  2. Add Cloned Repository to Your GitHub Desktop App.
Video Tutorial:
Reference: Main Link

How to connect to Remote Hyper-V in a workgroup network

We can access Hyper-V server and its machines through Hyper-V manager on a different machine if it is connected in Active Directory network.It will pickup the AD credentials we logged in with and provide access based on the rights the logged-in user have.
Prior to server 2016 and windows 10, we don’t have below option to connect with Remote Hyper-V.
1.PNG
So we don’t have option to use Hyper-V server on the previous OS of windows.
From the OS mentioned above (from windows 10), we can connect to remote Hyper-V server or client machines and access/control their VMs.
Before doing that, we need to configure some settings on the remote machine and on the local machine to create a trust between both the machines.
To do that, run below scripts on respective machines.
Server.ps1:
CommandLine : Set-ExecutionPolicy Unrestricted

CommandLine : Get-ExecutionPolicy

CommandLine : Start-Service WinRM

CommandLine : Enable-WSManCredSSP -Role "Server"

CommandLine : .\Configure-SMRemoting.exe -Enable

CommandLine : Set-NetFirewallRule -DisplayGroup 'Windows Management Instrumentation (WMI)' -Enabled true

CommandLine : Set-NetFirewallRule -DisplayGroup 'Windows Management Instrumentation (WMI)' -Enabled true -Passthru

CommandLine : Set-NetFirewallRule -DisplayGroup 'Windows Management Instrumentation (WMI)' -Enabled true -PassThru

CommandLine : Set-NetFirewallRule -DisplayGroup 'Remote Event Log Management' -Enabled true -PassThru

CommandLine : Set-NetFirewallRule -DisplayName 'File and Printer Sharing (Echo Request - ICMPv4-In)' -Enabled true 
              -PassThru

CommandLine : .\cscript.exe C:\Windows\System32\SCregEdit.wsf /AR 0

CommandLine : Set-NetFirewallRule -DisplayGroup 'Remote Volume Management' -Enabled true -PassThru

CommandLine : get-history | Format-List CommandLine | out-file c\server.txt
Client.ps1:
CommandLine : Enable-WSManCredSSP -Role "Client" -DelegateComputer "chellangi-2016"

CommandLine : Enable-WSManCredSSP -Role "Client" -DelegateComputer "chellangi-2016"

CommandLine : Connect-WSMan -ComputerName "chellangi-2016"

CommandLine : set-item wsman:\localhost\Client\TrustedHosts -value *

CommandLine : set-item wsman:\localhost\Client\TrustedHosts -value "chellangi-2016"

CommandLine : $current=(get-item WSMan:\localhost\Client\TrustedHosts).value

CommandLine : $current=(get-item WSMan:\localhost\Client\TrustedHosts).value

CommandLine : get-command *winrm*

CommandLine : get-command *remote*

CommandLine : get-command *winrm*

CommandLine : get-command *win*

CommandLine : get-command *remote*

CommandLine : winrm quickconfig

CommandLine : winrm quickconfig

CommandLine : clear

CommandLine : winrm quickconfig

CommandLine : winrm quickconfig

CommandLine : $Profile = Get-NetConnectionProfile -InterfaceAlias Ethernet1

CommandLine : Get-NetConnectionProfile 

CommandLine : $Profile = Get-NetConnectionProfile -InterfaceAlias ERWIN-AP01

CommandLine : $Profile = Get-NetConnectionProfile -InterfaceAlias "vEthernet (wifi)"

CommandLine : $Profile.NetworkCategory = "Private"

CommandLine : Set-NetConnectionProfile -InputObject $Profile

CommandLine : winrm quickconfig

CommandLine : winrm set winrm/config/client @{TrustedHosts="Name of the Server"}

CommandLine : winrm set winrm/config/client @{TrustedHosts="chellangi-2016"}

CommandLine : winrm set-winrm/config/client @{TrustedHosts="chellangi-2016"}

CommandLine : winrm set winrm/config/client @{TrustedHosts="chellangi-2016"}

CommandLine : winrm set winrm/config/client @{TrustedHosts="chellangi-2016"}

CommandLine : Enable-WSManCredSSP -Role "Client" -DelegateComputer "chellangi-2016"

CommandLine : Set-NetFirewallRule -DisplayGroup 'Remote Volume Management' -Enabled true -PassThru

CommandLine : get-history

CommandLine : get-history | format-list

CommandLine : get-history | format-list CommandLine

After that, add below settings on the local machine, to add remote machine to the trusted zone.
add to trusted.png

How to reset windows password

In the windows operating system, the credentials are stored in the registered in encrypted format at [HKEY_LOCAL_MACHINE\SAM]
This location won’t be visible once the OS is loaded.
This can be accessed during the boot time and we can access it by launching the command prompt during boot time and can clear or reset the password.
To make it simpler, below third party vendors provide bootable media or application to create that bootable media.
List of softwares to create the bootable media to reset windows password.
You can comment on the post if you need any details.

How push or sync commits to a different branch

Let’s say we have created a branch yesterday and committed some changes to master branch.
If we want to make both the branches even.
  1. Option 1 -> is to delete and recreate the branch again from master.
  2. Option 2 -> checkout to master branch and run below command.
    git push origin master:<new_branch>
All the commits are identified by a unique ID.So we don’t need to mention the parent branch of the commit if we know its ID.So, If we want to add only a specific commit, then run below command from the target branch checked out.
git checkout -b new_branch origin/new_branch -> If branch never checked out locally.
git checkout new_branch -> If already checked out locally.
git cherry-pick <commit-ID>
Reference: https://www.devroom.io/2010/06/10/cherry-picking-specific-commits-from-another-branch/

How to add windows node to Jenkins

Login to Jenkins portal and click on Manage Jenkins link.
Scroll down and click on Manage Nodes.
Click on new node link left side.
1.png
Provide node details and press OK.
2
Click on save after providing below details.
3.png
4
Now login to the Jenkins portal on the machine which we want to add as node.
And then go to the nodes section and click on the node we added.
Click on the launch button.
5.png
6.png
7.png
Select the below window and hold alt key to get the options enabled.
8
9.png
Click on refresh, so you can see the node added successfully.
10
Download document: Add windows node to jenkins

How to disable auto launch of server manager

On the windows server machines, I am taking 2012 as an example, server manager launches automatically once we login to the machine.
To disable that we need to set below option.
  1. Open the “Server Manager”.
  2. Select “Manage” on the top bar.
  3. Select “Server Manager Properties” from the drop down menu.
    1
  4. Select the option “Do not start Server Manager automatically at logon”.
    2

This can also be set using the below registry.
[HKEY_CURRENT_USER\Software\Microsoft\ServerManager]
“DoNotOpenServerManagerAtLogon”=dword:00000001
And the reverse option is
[HKEY_CURRENT_USER\Software\Microsoft\ServerManager]
“DoNotOpenServerManagerAtLogon”=dword:00000000
You can set the same key in HKLM to set it for all users.But we should not keep this registry value “DoNotOpenServerManagerAtLogon” in HKCU at that time as the User key will be given preference.

Temporary Directories for RDP sessions on windows

By default, In windows server machines, when you login to the machines using Remote Desktop Session, it will create a temporary sub directory in the temp folder and redirects to this when we tried to access temp folder using %temp%
1
As you see the number marked at the end.
2
We can disable this behavior using the below setting in group policy.
For server 2003:
group policy:  Administrative Templates\Windows Components\Terminal Services\Temporary folders . If you don’t select Do not use temporary folders per session, then these TEMP subdirectories are created.
For server 2008 and above:
group policy:  Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Temporary folders
3

The following tool, from Microsoft TechNet, allows management of Group Policy via the command line, and thus scripting as well:

The registry used is:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services]
“PerSessionTempDir”=dword:00000000

Enable or Disable projects in Jenkins

By default, you don’t have any option to enable/disable a job or project in Jenkins.
The default view will be like this.
1
If you observe, there is no disable/enable option.
To make it available, install the Extra Columns Plugin
Then create a new view of type “List View” and select your projects, then click on add column and select the below one.
2
This will give you a button to enable/disable the project in the view created.
2

Remote Desktop not connecting but able to ping

Sometimes, even if the remote machine is working with ping command but we won’t be able to connect it when we try to connect with mstsc (Remote Desktop Connection).
First and Foremost, check whether below setting is enabled in system properties -> Remote Settings.
Capture
If it is already enabled then check whether below firewall inbound rules are enabled.
Capture
Then it should work.
You should disable the firewall if it is a test machine ðŸ™‚
If you still not able to do that, then you need to check the network settings for the Antivirus installed on the remote machine.
For example, In eset Nod32 antivurs, we have option called personal firewall which should be configured properly or disabled.

Git Remote end Hung Up error

When you get a remote hung up error while trying to push the local repository to GitHub server, 2 cases arises.
1. Your local network issues.
2. GitHub upload size limit.
For the first case, to have a resume option, you can use the tool like Sourcetree.
For the second case, even though the individual file size limit is maintained, there is a size limit for pushing the repository but not one the complete code size.
The limit is 2 GB now.
If your repository is of more size.Then we can push in partitions.
This option is available with the help of below command, where the number of commits to be published are limited only till the commit code we specify.
git push <repo_name> <commit ID>:refs/heads/<branch_name>
Let’s say we have 1000 commits and we specify the 50th commit, then the commits from 1 to 50 will be pushed and later are skipped, if we specify the 150th commit later, then as already 50 commits are pushed, the commit range 51 to 150 will be pushed.

Difference or Relation between Jenkins, Maven and Ant

Jenkins will use Maven and ANT for building the applications like ear,jar,etc.
Ant and Maven are Build tools which is used to build the applications by using the code. Selection of Maven and Ant depends up on the project code which is developed by Developer.

How to exclude all the files except files starting with a name in the Git or GitHub

In the GIT project, I have many .sql files in it related to different databases.
Is there anyway I can exclude all the files except the files starting with “Hive_” in my Git Project.
Is there anyway to do so in .gitignore file.
Through .gitignore I can exclude the files list.
But the current requirement is reverse here, I want to exclude everything except files starting with specific characters.
To do that.
Create a .gitignore file in the root folder of the repository.
The .gitignore contents:
————————————–
# excluded all files
*.*
# except all files prefixed with Hive_
!Hive_*

How to exclude all files except some pattern in git

In the GIT project, I have many .sql files in it related to different databases.
Is there anyway I can exclude all the files except the files starting with “Hive_” in my Git Project.
Is there anyway to do so in .gitignore file.?
Through .gitignore I can exclude the files list.
But the current requirement is reverse here, I want to exclude everything except files starting with specific characters.
The answer is below.
You can use below pattern in your gitignore file.
# Ignore all
*
# but except below
! Hive_*

How to reset faststone capture trial period



How to reset beyond compare trial period

Download Link: BeyondCompare

Useful Applications

Not only for DevOps , the below applications are used in many areas.
1. File comparison tools : Winmerge, Beyond Compare.
2. Screen recording: As a document you can go with psr.As a video there is camtasia, faststone capture.

Artifactory Setup

JFrog Artifactory delivered to users in 3 modes.
1. JFrog Artifactory OSS – Open Source Version.
2. JFrog Artifactory Pro – Licensed version and to be purchased.
3. JFrog Artifactory cloud – to be purchased.
3rd option is cloud based and no need of any server setup from our end.1st and 2nd are local on premise versions and need a local server setup.Open source version don’t have extendability like Pro version with the help of third-party plugins.
In the below link I have shared how to setup a local artifactory open source version on a windows 10 machine.
You can download the OSS type from JFrog website directly.