Install MSI File to Custom Directory using PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 10:02:51

3K+ Views

To install the MSI file to the custom directory using PowerShell, we can use the TARGETDIR, INSTALLDIR, INSTALLPATH, etc arguments for the custom path, depending upon the MSI file that it supports.msiexec /i "C:\temp\7z1900-x64.msi" INSTALLDIR="D:\ProgramFiles\7zip" /quietThe above command can be run into PowerShell and cmd both but you can’t control the process that to wait until the installation finishes. To control the above command, we can use the Start-Process cmdlet in PowerShell.Start-Process -FilePath "C:\windows\system32\msiexec.exe" -ArgumentList "/i C:\temp\7z1900-x64.msi INSTALLDIR='D:\ProgramFiles\7zip' /quiet" -WaitIf the INSTALLDIR is not supported by the MSI file then you can use the other parameters as specified above or ... Read More

Get Location of Azure VM Using Azure CLI in PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 09:47:35

767 Views

To find the location of the particular Azure VM using Az CLI, we can use the below command but before that, you need to make sure you are connected to the Azure cloud and had set that specific subscription.PS C:\> az vm show -n VMName -g ResourceGroupName --query '[location]' -otsvAlternatively, you can use the below command to get the location of the Azure VM.PS C:\> az vm list --query "[?name==’VMName’].location" -otsv

List Azure VMs Using Azure CLI in PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 09:46:33

9K+ Views

To list all the Azure VMs connected to the particular subscription, we need to use the “Az vm” command. Before that, we need to make sure the Azure is connected to the desired subscription, if not use the below command to set the Azure Subscription.az account set -s 'subscription name or id'Once the Azure subscription is set, we can use the below command to retrieve the Azure VMs.PS C:\> az vm list -otableTo get the particular azure VM using CLI, we need to provide the VM name and resource group name.PS C:\> az vm show -n VmName -g ResourceGroupName -otable“az ... Read More

Get Azure Resource Group Using Azure CLI in PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 09:45:49

9K+ Views

To get all the Azure resource groups connected to the particular subscription use the az group command.Before using this command make sure you are connected with the Azure account and if not connect the azure account with the “Az login”Once you are connected to the Azure account, set the subscription name for which you want to retrieve the resource groups.az account set --subscription 'subscription name or id'Once you have set the subscription, use the below command to retrieve all the resource groups.PS C:\> az group list -otableTo get the particular resource group details, use the below command.PS C:\> az group ... Read More

Connect to Azure Subscription Using Azure CLI in PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 09:45:03

9K+ Views

To connect to the specific azure subscription using Az CLI we need to use “Az account set” command but before using this command make sure you are connected with the Azure cloud using “az login” account.az account set --subscription 'subscription name or id'You can also use -s instead of --subscription.az account set -s 'subscription name or id'To check if the subscription is set properly, use the below command.PS C:\> az account show -otable

Log In to Azure Account Using AZ CLI Command in PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 09:42:58

16K+ Views

To login to the Azure account using Azure CLI, we need to use the az login command. Once you type the az login command, it will prompt for the Azure portal login console.If you need to log in with the device authentication code in the browser, you need to use the parameter –use-device-code.PS C:\> az login --use-device-code To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ‘DeviceCode’ to authenticate.You need to open a website https://microsoft.com/devicelogin/ and have to enter a code. If you are not already connected with the Microsoft Azure portal, you ... Read More

Get Application Security Groups of Azure VM Using PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 09:40:48

596 Views

To get the Application security groups of the Azure VM using PowerShell, we need to first get the Network Interface of the Azure VM.The below command will retrieve the NIC name of the Azure VM.PS C:\> $vm = Get-AzVM -Name TestVM $nic = (($vm.NetworkProfile.NetworkInterfaces.id).Split('/'))[-1]Once we have the NIC name, we can use the Get-AzNetworkInterface command to retrieve the NIC information and the Security group.The below command will retrieve the application security group names using PowerShell.PS C:\> $nicsettings = Get-AzNetworkInterface -Name $nic $nicsettings.IpConfigurations.ApplicationSecurityGroups

Retrieve Azure Subnets Connected to Virtual Network Using PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 09:38:11

3K+ Views

To get all the subnets attached to the virtual network using PowerShell, we need to use the GetAzVirtualNetwork command.PS C:\> $vn = Get-AzVirtualNetwork -Name VirtualNetworkNameTo get the Subnets and its address prefix details, you need to filter out the Subnets and AddressPrefixPS C:\> $vn.Subnets | Select Name, AddressPrefix

Find File Modified After a Certain Date Using PowerShell

Chirag Nagrekar
Updated on 31-Aug-2021 08:48:36

17K+ Views

To get all the files that are modified after certain days, we need to use the LastWriteTime property.The below command shows us the files which are modified within the last 30 days in the C:\temp folder.Get-ChildItem C:\Temp | where{$_.LastWriteTime -ge (GetDate).AddDays(-30)}You can also use the AddMonths() or AddYears() instead of AddDays() as per your requirement.To get all the files that are modified before 30 days, use the below command.Get-ChildItem C:\Temp | where{$_.LastWriteTime -le (GetDate).AddDays(-30)}To get the file modified after a specific date, you need to compare the LastWriteTime with the Date. For example, we need all the files that are ... Read More

Electric Power and Efficiency of Electric Devices

Manish Kumar Saini
Updated on 30-Aug-2021 13:20:37

1K+ Views

Power or Electric PowerThe rate at which work is done in an electric circuit is called as electric power. In other word, the work done per unit time is termed as electric power. It is denoted p or P.Formula and Unit of PowerWhen voltage is applied across a resistor, it causes current to flow through it. Therefore, work is being done in moving the electrons through the resistor in a unit time is called the electric power.Referring the above figure, $$\mathrm{V=\frac{work}{Q}}$$$$\mathrm{\Rightarrow work(W)=VQ=VIt}$$As, the power is defined as work done per unit time i.e.$$\mathrm{Power(P)=\frac{work\:done\:in\:electric\:circuit(W)}{Time(t)}=\frac{VIt}{t}}$$$$\mathrm{(∵V=IR\:or\:I=\frac{V}{R})}$$$$\mathrm{∴P=VI=I^2R=\frac{V^2}{R}}$$The above three formulae are equally valid for ... Read More

Advertisements