Found 2043 Articles for Microsoft Technologies

How to use the tree command in PowerShell?

Chirag Nagrekar
Updated on 25-Jan-2021 07:26:41

9K+ Views

Tree command graphically shows the folder structure of the given drive or a path. It is similar to Get−ChildItem or dir recursive command except this shows the graphical structure. For example, the below command will retrieve the folder structure of C:\VMs includingtree c:\VMsOutputThere are also two other switches supported for this command. They will appear in the help section of this command.c:\>tree /? Graphically displays the folder structure of a drive or path. TREE [drive:][path] [/F] [/A] /F Display the names of the files in each folder. /A Use ASCII instead of extended characters.This command is a cmd utility ... Read More

How to change the TLS version in PowerShell?

Chirag Nagrekar
Updated on 25-Jan-2021 07:26:56

3K+ Views

Transport Layer Security known as TLS is a very important part while using URI commands such as Invoke−WebRequest or Invoke−Restmethod commands and package commands such as Find−Package or Install−Package because they interact on the internet and PowerShell needs TLS1.2 version for that.We may get the below errors when we use the lower TLS version.WARNING: Unable to download the list of available providers. Check your internet connection. WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'. Find-Package : No match was found for the specified search criteria and package nameTo resolve the above error, we need to change the TLS version. To check ... Read More

How to format the disk using PowerShell?

Chirag Nagrekar
Updated on 25-Jan-2021 07:23:31

822 Views

To format the disk using PowerShell, we can use the Format−Volume command. For example, we have to format the E: on the local server then we can use the simple format command as shown below.Format−Volume −DriveLetter E −Force −VerboseTo format the disk with the specific filesystem use the below command.Format−Volume −DriveLetter E −FileSystem NTFS −Full −Force −VerboseThe above command with Format the E drive with the NTFS file system (there are other file systems like FAT, FAT32, exFAT) forcefully.You can even change the label for the drive while formatting using −NewFileSystemLabel command.Format−Volume −DriveLetter E −FileSystem NTFS −NewFileSystemLabel "Temporary Stroage" −Full ... Read More

How to change the local disk name using PowerShell?

Chirag Nagrekar
Updated on 25-Jan-2021 07:23:14

3K+ Views

To change the local disk name using PowerShell, we can use the Set−Volume command. For example, we have Drive name F and its volume label is “New Volume” and need to change it to the “Temporary Storage” then we can change the label using its existing volume name or with the Drive letter.To change the volume name with the Drive letter, Set−Volume −DriveLetter 'E' −NewFileSystemLabel 'Temporary Storage'To change it with the existing label, Set−Volume −FileSystemLabel 'New Volume' −NewFileSystemLabel 'Temporary Storage'For the remote system, we can use either Invoke−Command or the CIMSession parameter.For example, $sess = New−CimSession −ComputerName Labmachine2k12 Set−Volume −CimSession ... Read More

How to change the Drive letter using PowerShell?

Chirag Nagrekar
Updated on 25-Jan-2021 07:15:34

2K+ Views

To change the drive letter using PowerShell, we can use the Set−Partition command but before that, we need to know which drive letter to change. You can check the drive letter using Windows Explorer, Get−Partition, Gwmi win32_Logicaldisk, or Get−CimInstance Win32_Logicaldisk command.Suppose we have an E: and we need to rename its drive letter to F, so we can use the below command.Set−Partition −DriveLetter 'E' −NewDriveLetter 'F'Make sure that the drive is not in use by Pagefile, open application, or open file from the drive otherwise the drive letter will fail to change.To change the drive letter on the remote computer, ... Read More

How to get the disk information using PowerShell?

Chirag Nagrekar
Updated on 25-Jan-2021 07:15:06

6K+ Views

To get the Windows disk information using PowerShell, we can use the WMI command or the CIM class command.With the WMI command, Gwmi Win32_LogicalDiskWith the CIM instance method, Get−CimInstance Win32_LogicalDisk You can see both the outputs are identical. Let’s use one of them.DeviceID DriveType ProviderName VolumeName Size FreeSpace -------- --------- ------------ ---------- ---- --------- C: 3 53317988352 44027125760 D: 5 HRM_SSS_X64FREE_EN-US_DV5 3694962688 0 E: 3 Temporary Storage 10734268416 10238513152Now there are different drive types associated with Windows and they each have an identical number. For example, Drive Type ‘3’ mentions the logical disk. The other types are as below.2 = ... Read More

How to install the Nuget Package using PowerShell?

Chirag Nagrekar
Updated on 25-Jan-2021 07:18:40

19K+ Views

Nuget is the package management tool for the .NET and it is similar to PowerShellGet, MSI packages which support several commands and packages to work with PowerShell.NuGet supports Install−Package, Update−Package, Find-Package, and Get−Package command and if Nuget package is not installed in your system, you may not find a package or install any package.For more reference about Nuget, check the websites below.https://www.nuget.orghttps://docs.microsoft.com/en-us/nuget/reference/powershell−referenceTo install NuGet, we need to use the Install−PackageProvider command. Use the below command to install the Nuget package.Install−PackageProvider −Name Nuget −ForceOn some machines, you will get the error message regarding downloading the package from the internet. If you ... Read More

Ways to use Where-Object in PowerShell

Chirag Nagrekar
Updated on 25-Jan-2021 07:11:07

2K+ Views

Where−Object or (alias: Where) in PowerShell is used to filter the data output provided through the Pipeline.There are two methods we can use the Where−Object for the pipeline inputs.a. ScriptMethod −In this method, we use ScriptBlock to filter the output with the Property name, value, and the comparison operator.Get−Service | Where−Object{($_.StartType −eq 'Automatic') −and ($_.Status −eq 'Stopped')}You can also use Alias: Where instead of Where−Object.Get−Service | Where{($_.StartType −eq 'Automatic') −and ($_.Status −eq 'Stopped')} Other Syntax ‘?’ (Question Mark) can also be used Instead of the Where−Object command.Get−Service | ?{($_.StartType −eq 'Automatic') −and ($_.Status −eq 'Stopped')}The above commands will get the ... Read More

How to change the color of the PowerShell ISE editor using command?

Chirag Nagrekar
Updated on 18-Jan-2021 07:44:08

2K+ Views

To change the color of the ISE Editor, we need to use $psISE cmdlet which is only available for the ISE editor.Now in the ISE editor, we have many colors some are visible (ScriptPane color, Console Color, etc) and some appear while executing a script (Error, Warning, Verbose). These properties are as below.ErrorForegroundColor : #FFFF9494 ErrorBackgroundColor : #00FFFFFF WarningForegroundColor : #FFFF8C00 WarningBackgroundColor : #00FFFFFF ... Read More

How to change PowerShell ISE font Size using command?

Chirag Nagrekar
Updated on 18-Jan-2021 07:41:03

2K+ Views

To change the font size of the PowerShell ISE editor using the command, we need to use the cmdlet $PSISE which is only loaded inside the PowerShell ISE console. You won’t find it in the main PowerShell console.Once you run this command, there are various properties available. For example, PS C:\> $psISE CurrentPowerShellTab          : Microsoft.PowerShell.Host.ISE.PowerShellTab CurrentFile                   :  Microsoft.PowerShell.Host.ISE.ISEFile CurrentVisibleHorizontalTool  : CurrentVisibleVerticalTool    : Options : Microsoft.PowerShell.Host.ISE.ISEOptions PowerShellTabs                :  {PowerShell 1}You need to select the Options Property and then need to ... Read More

Advertisements