Posts

How to Change the Hostfile Entry in the Cent OS 7

In Order to change the host file entry in the Centos 7, you may need to login on the console using the root credentials and have to run the below command:  # hostnamectl set-hostname Once the above command is executed you may need to restart the network services to ensure the changes made persists in the system. # /etc/init.d/network restart Comment below in case of any queries 

Important Vcenter Appliance CLI commands

Image
vCenter Server services  running status can be checked  using this command service-control --status --all It Should return the result as depicted below:

Running CLI Commands in ESXi using plink software

Image
Get-esxcli will help us to run the CLI commands over the host directly but to extend it we cannot run certain commands directly over the host, In such case, we can use the below script to run directly on the host and achieve our goals. One shot with the script to achieve multiple targets My target was given to check the status of smartd services in each host and disable it, So I have put the commands on the variable $cmd and $cmd2 and executing it in all the machines,  which has been feed in the variable $machines , command get executed in all the hosts fed in the variable $machines . Script :  $user = '' $pswd = '' $cmd = 'etc/init.d/smartd status' $cmd2 = 'chkconfig smartd off' $machines = Get-Content "" foreach ( $MACHINE in $machines ) { Get-VMHost -Name $MACHINE | % {     $ssh = Get-VMHostService -VMHost $_ | where { $_ . Key -eq 'TSM-SSH' }     if ( ! $ssh . Running)

How to reset the IE settings Through command Line (CMD)

Image
I was just wondering that how to reset the IE personal settings through command line as I am much more interested over the cli functions, just got this command to reset the settings of the IE to the default one. rundll32 inetcpl.cpl ResetIEtoDefaults Run the above code by pressing the (windows key + R), Just type the above command and you will get the below prompt. just select the checkbox and click reset button all is done.

Default powershell commands not getting executed , getting command not recognized.

I was working on some weird cases that some of the basic powershell commands are not getting  executed in the machine and i came to know that the powershell modules are not getting loaded due to which default modules are not getting loaded in the psmodule path. Resolution would be to run the below commands: $PSModulePath = Get-ItemProperty -Path "HKLM:SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name "PSModulePath" $newPSModulePath = $PSModulePath.PSModulePath + ";C:\Windows\System32\WindowsPowerShell\v1.0\Modules" Set-ItemProperty -Path "HKLM:SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name "PSModulePath" -value $newPSModulePath Else you need to create a PSModulePath value under the below path : HKLM:SYSTEM\CurrentControlSet\Control\Session Manager\Environment and need to enter the value of path mentioned below in the PSModulePath key : %SystemRoot%\system32\WindowsPowerShell\v1.0\M

How to extract msu/msp/msi/exe files from the command line

We can use the below commands to extract and execute the msu/msp/msi/exe files through cli mode.   Microsoft Hotfix Installer (.exe) setup.exe /t:C: /c Microsoft Update Standalone Package (.msu) expand -F:* update.msu C: cd expand -F:* update.cab C: Microsoft Patch File (.msp) msix patch.msp /out C: msix.zip Windows Installer Package (.msi) msiexec /a setup.msi /qb TARGETDIR=C:

Fetch the List of RDMs Attached in the machine using Powercli

Image
I used to maintain a powercli toolkit to ensure all the redundant tasks which ever to be performed can be automated in the proper way without affecting the running environment. I am sharing a script which comes in handy when you need to identify the list of RDMs attached to the virtual machines in the cluster Get-Cluster | Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent,Name,DiskType,ScsiCanonicalName,DeviceName | Export-csv -notypeinformation -path "c:\RDMattachedmachine" => Indicates that you have to put the cluster name in the space and execute the command. This command has been tested under vcenter 5.5 and 6.0.  Run with care in the production environment and happy scripting. Kindly put your comments and queries below.