Posts

Showing posts from June, 2017

Auto creation and deletion of Snapshots in Vsphere Environment using Powercli

Image
Today we are gonna develop a script that will automatically delete multiple snapshots that has been taken in VMs running in the Vsphere environment. We use powercli to create the script and run over the vcenter where the VMs are hosted Before we go ahead, I would like to share you a small brief on what is powercli, powercli is a command-line interface (CLI) tool for automating vSphere and vCloud management. VMware vSphere PowerCLI debuted as the VMware Infrastructure Toolkit, also called the VI Toolkit. We have created two machine named test-vigneshbabu, test1-vigneshbabu as shown below: Now we are gonna trigger a script that will take the snapshot of these machines as “before patching” as shown below, You can customise the name of the snapshots according to your standards. Code : $servers = Get-Content "c:\vm-serverslist.txt" foreach ( $i in $servers ) {  New-Snapshot -VM $i -Name before_pathing } Note: path of the get-content is customisable and it’s the file

NLM Errors in the Windows SCCM Client

Image
1.     Stop the windows update service, rename or delete the Software Distribution folder (%windir%\softwareDistribution) and start windows update service. This approach provides a fresh start with a new Windows Update data store if the Datastore.edb file is corrupted. 2.     Open Windows update log file under path C:\Windows\WindowsUpdate.log and check latest logs especially NLM error. 3.     Download below KB article from Microsoft catalog site. KB2919355 or you can download the the patches from the below link.     https://www.microsoft.com/en-us/download/details.aspx?id=42334 4.     Uninstall all patches(KB2919355, KB2932046, KB2959977, KB2937592, KB2938439, KB2934018, KB2919442) if it is installed and restart server 5.     Install KB2919355 now on server and restart server again. 6.     Restart the windows update service, Go to control panel, open configuration manager, Go to Actions tab and trigger software update scan cycle and software update deployment evaluati

Changing the path policy of the SCSI lun device using Powercli in Vmware Vsphere Environment

Image
Today my motto is to change the path policy of the scsi lun from Fixed to round robin. It’s always a pain to change the path policy of the scsi lun device, it takes hours of time to change the path manually in case if we have the large environments of say 2000 ESXi and with more than 400 Devices connected with the Esxi. so we used some Powercli and create a loop to perform the redundant task well in crisp words we tried to automate this task which could save hours of manual works Code: $server = Get-content "C:\hostfile.txt" foreach ($i in $server) { Get-ScsiLun -VmHost $i -CanonicalName "naa.6006*" | where {$_.MultipathPolicy -ne "RoundRobin"} | Set-ScsiLun -MultipathPolicy RoundRobin } Here in the above code I am calling the list of ESXi Host in the file named as hostfile.txt and passing it to the variable $server and this will create an array of characters over the variable $server , Each character represents Esxi hosts on devops

Rejoin a Computer to domain without Restart using powershell

Image
There are three methods to rejoin the computer to domain without restart Method 1: Test-ComputerSecureChannel -Repair -Credential (Get-Credential) When the above command is executed it will prompt for username and password and enter the domain credentials and result should show as true then the machine is re-added to domain. Method 2: netdom resetpwd /Server:DC /UserD:DomainAdmin /PasswordD:Password The above command should be executed in the command prompt under administrator prompt. Method 3: Reset-ComputerMachinePassword -Credential (Get-Credential) When the above command is executed it will prompt for username and password and enter the domain credentials and result should show as true then the machine is re-added to domain. Stay Tuned and connect with me @ Click to connect