Retrieve Windows Registry Keys and Values Using PowerShell

Chirag Nagrekar
Updated on 08-Feb-2021 07:31:24

6K+ Views

To browse through the registry in PowerShell, we can use the Get-ChildItem command. For example to get all keys from the path HKLM:\Hardware we can use the below command.Get-ChildItem HKLM:\HARDWAREOr you can set the location and use the dir (get-ChildItem or ls) command to browse the path.ExamplePS C:\> Set-Location HKLM:\HARDWARE PS HKLM:\HARDWARE> dirOutputHive: HKEY_LOCAL_MACHINE\HARDWARE Name    Property ----    -------- ACPI DESCRIPTION DEVICEMAP RESOURCEMAPTo get the properties of the key, use the Get-ItemProperty command.ExampleSet-Location 'HKLM:\SOFTWARE\VMware,  Inc.' Get-ItemProperty '.\VMware Drivers'Outputefifw.status   : 1|1.1.0.0.0.1|oem2.inf vmxnet3.status : 1|1.1.8.16.0.1|oem3.inf pvscsi.status   : 1|1.1.3.15.0.1|oem4.inf vmusbmouse.status : 1|1.12.5.10.0.1|oem5.inf vmmouse.status : 1|1.12.5.10.0.1|oem6.infRead More

Delete Registry Key Value Property Using PowerShell

Chirag Nagrekar
Updated on 08-Feb-2021 07:28:37

13K+ Views

To delete the registry key value using PowerShell, we can use the Remove-ItemProperty command. Suppose we have the registry NodeSoftware and its Property is AppSecurity. We need to delete its key using the Remove-ItemProperty command.PS C:\> Get-Item HKLM:\SOFTWARE\NodeSoftware Hive: HKEY_LOCAL_MACHINE\SOFTWARE Name    Property ----    -------- NodeSoftware    AppSecurity : 1To delete the registry key, PS C:\>Remove-ItemProperty HKLM:\SOFTWARE\NodeSoftware\ -Name AppSecurity -Force -Verbose VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\NodeSoftware\ Property: AppSecurity".You can also delete property by setting the location. For example, ExamplePS C:\> Set-Location HKLM:\SOFTWARE\NodeSoftware PS HKLM:\SOFTWARE\NodeSoftware> Remove-ItemProperty -Path . -Name AppSecurity -Force -VerboseTo remove Item property using Pipeline, Get-Item HKLM:\SOFTWARE\NodeSoftware | Remove-ItemProperty -Name AppSecurity -Force -VerboseRead More

Extract Axes Labels for Plot Using ggplot2 in R

Nizamuddin Siddiqui
Updated on 08-Feb-2021 06:38:19

609 Views

When we create a plot using ggplot2, the axes labels are automatically generated for both the axes. We might want to use those axes labels for report writing or some other purpose, therefore, extraction of those labels for a plot created by using ggplot2 package can be found by using the ggplot_build function as shown in the below example but we need to save the plot in an object.Consider the below data frame −Example Live Demox

Change Default Point Type for Scatterplot Using ggplot2 in R

Nizamuddin Siddiqui
Updated on 08-Feb-2021 06:35:49

280 Views

To change the defaults for ggplot2 geoms, we need to use update_geom_defaults function. If we want to change the shape of points for scatterplot, we can use the below syntax −update_geom_defaults("point",list(shape=”point_shape_number”))The point shape number ranges from 0 to 25. We can change that according to our need.Consider the below data frame −Example Live Demox

Create Boxplot for List Elements using ggplot2 in R

Nizamuddin Siddiqui
Updated on 08-Feb-2021 06:33:40

739 Views

If list elements are of equal size having numerical values then the boxplot for each element can be created by using ggplot2 but before creating the boxplot we would need to convert the list to a data frame. The conversion of list elements to a data frame will be done by unlisting of elements and creating two columns, one for categories and one for response variable. Check out the below example to understand how it works.Consider the below list −Example Live DemoList

Create Boxplot for a List Object in Base R

Nizamuddin Siddiqui
Updated on 08-Feb-2021 06:31:26

1K+ Views

A list object can contain multiple elements of data, also the size of the data may vary. If a list object has numerical vectors then the boxplot for each of the elements can be created simply by using boxplot function. For example, if we have a list object called LIST that contains five numerical vectors then the boxplot for each of the vectors can be created by using the command boxplot(LIST)Example Live DemoList

Change First Value for Each Group in Data Table Object in R

Nizamuddin Siddiqui
Updated on 08-Feb-2021 06:29:14

747 Views

To change the first value for each group in data.table object, we can use single square brackets for accessing and changing the value to desired value. For example, if we have a data.table object called DT that contains a group column defined by Class and a numerical column defined by Response then the first value of Response for each Class can be set to say 5 by using the command DT[,Response:=c(2,Response[-]),by=Class]Consider the below data.table object −Examplelibrary(data.table) Group

Display Text in Base R Plot with 180 Degrees Rotation

Nizamuddin Siddiqui
Updated on 08-Feb-2021 06:25:39

2K+ Views

To display text in base R plot with 180 degrees rotation, we can use text function. We would need to define both the axes values for the position where we need the text to be rotated inside the plot. For the rotation of the text, srt argument will be used and set to the value equals to 270. Check out the below example to understand how it works.Examplex

Create a Plot of Binomial Distribution in R

Nizamuddin Siddiqui
Updated on 08-Feb-2021 06:24:09

2K+ Views

A binomial distribution is based on the distribution of success and failure, the other two parameters of binomial distribution are the sample size and the probability of success. To create a plot of binomial distribution, we first need to define the density of the binomial distribution using dbinom function. The plotting can be done by using plot function with success and the density as shown in the below examples.Examplex

Remove Duplicate Rows in R Data Frame Based on Two Columns

Nizamuddin Siddiqui
Updated on 08-Feb-2021 06:21:56

1K+ Views

If two values are repeated in a column that means there are many same values in that column but if those values are repeated in column as well as rows then they are called duplicated rows in two columns. To remove duplicate rows in an R data frame if exists in two columns, we can use duplicated function as shown in the below examples.Consider the below data frame −Example Live Demox1

Advertisements