Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Blog posts : "powershell"

Microsoft Azure Rest API using PowerShell

Using Microsoft Azure REST API is great way to automate Azure Resources and operations. Some times I have found PowerShell Az module is not present on remote servers and I need to automate azure things, Rest API is very handy at the time when features which are not available on PowerShell module AZ.…

Read more

Connect-AzAccount The 'Connect-AzAccount' command was found in the module 'Az.Accounts', but the module could not be loaded

While connecting to Azure using powershell with Connect-AzAccount cmdlet I was receiving below error. As troubleshooting steps I tried to update/install Az module from online Microsoft PowerShell repository with -Force and -AllowClobber parameters, tried to Import Module Az, Az.Accounts on PowerShe…

Read more

Powershell WPF MahApps.Metro update theme library

This script is just an update to new dll libraries of MahApps.Metro theme for Powershell WPF. I had already written basics of  Part 3: Powershell wpf MahApps.Metro theme step by step guide but, It is almost 2 years back and I was using MahApps.Metro 1.6 version and new version of MahApps.Metro v2…

Read more

Powershell adding leading zeros to string or int

I was working on a script project where I wanted to create and defined names for multiple virtual machine in the series, with maintaining length of the string of names with numbers adding leading zeros, Below -f format operator one-liner command helps me to create the list.

Read more

Powershell Dell iDrac redfish Rest API basic authentication

In one of my blog Configure Dell iDrac9 Rest API with Powershell I showed how use x-auth-token to connect to Dell iDrac, here I instead of token, using basic authentication (use UserName and Password each time to connect to Redfish iDRAC rest api), This is just a example and I will be using expli…

Read more

Powershell web scrapping extract table from html

This is small script I use to collect the table data from website to Powershell Object and then further it can be saved to csv file. For this example I am taking table example from https://datatables.net. I will try to convert table to Powershell Object. HTML tables has tags th (Table header) and …

Read more

PowerShell slice array into groups of smaller arrays

This is a small script to slice or break array into groups of smaller array, and I use it in my scripts most often. This script is very helpful when I want to batch process multiple server at time but not on all the server, instead fewer servers at servers in batch. Once I have a very big fat list o…

Read more

Powershell Convert range of numbers into another list of numbers maintaining ratio

Recently I was working on some PowerShell GUI project, Where I wanted to convert a range of number into another range of number maintaining ratio, for this I had to use one Arithmetic Math formula and, for example I have numbers between 1 to 200, Which I wanted to fit into new number of range bet…

Read more

Powershell vCenter server Rest API create and assign tag and tagcategory

While working on one of the automation project I wanted to assign tags and tag category on VMware clusters using Powershell, It is easy task when done using PowerCLI module but the requirement was not to use PowerCLI module instead make use of vSphere vCenter Rest API

PowerCLI create, modif…

Read more

Powershell Find application window state minimized or maximized

While working on one of the small freelance project there was a requirement to find whether launched application/process is minimized or maximized (For example when I open Microsoft excel what is the state whether it is minimized or maximized). This value of window state you can easily get with UIAu…

Read more

Configure Dell iDrac9 Rest API with Powershell

After writing  2 articles related on HPE ILO rest api, I had to automate Dell iDRAC9 systems using powershell. Dell iDRAC9 rest API is based on Redfish resources. HPE ILO5 also uses redfish for APIs but the resources and parameter usage are somewhat totally different, So  I wrote Dell iDRAC codes fr…

Read more

Powershell Configure ILO5 using Restful API

This is second part of PowerShell HPE ILO4 Rest API automation examples. In earlier part I shown how to use Rest API on ILO version 4. But the same API didn't work on ILO5 for me, After verifying document for ILO5, I found it uses RedFish rest api.

What is Redfish? 
DMTF's Redfish® is a sta…

Read more

PowerShell HPE ILO4 Rest API automation examples

Using Microsoft PowerShell to consume and automate any Restful API is very easy. In my earlier article I showed how to automate VMware product to automation rest api - Powershell Using vRealize Log Insight Rest API. In this article I am using HPE ILO4 Rest API to write automation scripts and how …

Read more

Powershell Using vRealize Log Insight Rest API

I had an assignment to automate vRLI (VMware vRealize Log Insight) using Powershell as well as Ansible. Here in this article I am showing how to use Microsoft Powershell to automate vRLI configurations. The best part about vRLI is, it provides Rest API which you can easily consume with any scripting…

Read more

PowerCLI Get-VMhost The operation on computer failed The WinRM client cannot process the request

I frequently get error winrm client cannot process the request while running few VMware PowerCLI commands for example: Get-VM, Get-VMhost etc. The complete error is highlighted as below in the Red, This generally happens due to duplicate cmdlet name in the another module.

Microsoft Powershell Module PowerCLI vmware.Powercli vmware vsphere esxi connect-viserver import-module get-vmhost winrm hyper-v module vcenter server vcsa vsphere client visual studio code.png

Import-Module VMw…

Read more

Powershell New-Object Retrieving the COM class factory for component with CLSID 80040154 Class not registered (Exception from HRESULT 0x80040154 (REGDB_E_CLASSNOTREG))

I was trying to use PowerShell object InternetExplorer.Application for automation purpose, While running my Powershell scripts on my VMs, I was receiving below error. To troubleshoot further I tested other Microsoft object for example: Excel.Application and Outlook.Application. Still I was recei…

Read more

Step by Step guide to push your first project to github.com

Powershell Write-Eventlog The source name test does not exist on computer localhost

I was writing one GUI program on Microsoft Powershell, One of the requirement was logs (Information, Warnings and Errors) must be written under Event Log - Event Viewer, So troubleshooting or information viewing for program operations is easy and everything is logged properly. To fulfill the task th…

Read more

PowerShell Invoke-WebRequest The underlying connection was closed: Could not establish trust relationship for the SSL TLS secure channel.

I face below error frequently whenever try to automate a website running self signed or invalid certificate, Here is my lab vCenter server for demo which is using self signed SSL certificate. This causes my script to fail whenever using Invoke-WebRequest to automate website. You can trust the cer…

Read more

PowerShell Invoke-WebRequest The request was aborted Could not create SSL TLS secure channel

I was testing automating few banking websites to check uptime, Invoke-WebRequest is use to access webiste, using this command I wrote a script to access bank website with PowerShell commands, but while executing scripts it was failing to access web site and showing below error.

Invoke-We…

Read more

20 blog posts

Blog Search

Page Views

9280358

Follow me on Blogarama