Chirag Nagrekar has Published 465 Articles

How to remove a member from the local group using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 10:49:53

5K+ Views

To remove a member from the local group using PowerShell, we can use the RemoveLocalGroupMember command. This command is available in the module Microsoft.PowerShell.LocalAccounts in and above PowerShell version 5.1.To use this command, we need to provide two parameter values. One is the -Group (Local Group Name) and the second ... Read More

How to create a new local group using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 10:48:00

807 Views

To create a new local group on the local or the remote system using PowerShell, we can use the NewLocalGroup command. ExampleNew-LocalGroup -Name "TestGroup" -Description "Test Group"OutputName       Description ----       ----------- TestGroup Test GroupYou can verify it from the Computer Management GUI.To create the local group on ... Read More

How to add users and groups to the local groups on Windows System using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 10:45:18

3K+ Views

To add users to the local groups using PowerShell, we need to use the Add-LocalGroupMember command (Module − Microsoft.PowerShell.LocalAccounts).Add-LocalGroupMember -Group "Administrators" -Member "NewLocalUser", "labdomain\Alpha", "Labdomain\ITSecurity"The above command adds 2 users (NewLocalUser (Local) and Alpha (Domain)) and one Domain Security Group ITSecurity to the Local Administrators group.You can also use the other ... Read More

How to get the list of local groups using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 02-Nov-2020 10:43:50

12K+ Views

To get the local groups on the windows system using PowerShell, you can use the Get-LocalGroup (Module: Microsoft.PowerShell.LocalAccounts) command. This command will list down all the groups on the particular system.If we check the properties of this command, it supports Name, Description, ObjectClass (user or group), PrincipalSource (ComputerName – Local ... Read More

How does PowerShell Pipeline work – Part 2?

Chirag Nagrekar

Chirag Nagrekar

Updated on 16-Oct-2020 09:49:39

102 Views

In part-1 we have seen the PowerShell pipeline functionality using the ValueFromPipeline property. There is another cmdlet property known as ValueFromPipelineByPropertyName, which is also useful to know the PowerShell pipeline functionality.Like part-1 command, we can get this property name using the same Get-Command but the filter parameter we will use ... Read More

How does PowerShell Pipeline work – Part 1?

Chirag Nagrekar

Chirag Nagrekar

Updated on 16-Oct-2020 09:44:27

118 Views

PowerShell is made easier with the Pipeline structure. With the Pipeline structure, we can pass the input of the left side command output or string to the right side of the command as the input. For example, Get-Service | Out-File c:\services.txtIn the above example, we are passing Get-Service output as ... Read More

How to block ports on the Windows Operating System using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 16-Oct-2020 09:39:26

3K+ Views

To block the port using PowerShell on the Windows OS, we need to change the firewall settings using the New-NetFirewallRule command.ExampleWe need to block the port 5985 on the computer. The below code will block all TCP Incoming requests on the 5985 port on the local computer.New-NetFirewallRule -DisplayName "Block WINRM HTTP Port" `       ... Read More

How to open a port in the Windows Operating System using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 16-Oct-2020 09:35:20

2K+ Views

To open a port in the Windows Operating system, we need to know a few things. LikeFor which Profile we need to open port (Public, private, or Domain)? - OptionalWhich port do we need to open (port Number)?The direction of the port – Inbound (i.e Incoming requests) or Outbound (i.e. ... Read More

How to change files and folders attributes using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 16-Oct-2020 09:28:49

8K+ Views

There are multiple files and folders attribute supported by the Windows Operating System. To check which attributes that files and folders support use DOS command attrib /?You can see the attributes listed like Read-Only, Archive, etc. You can set the attribute using PowerShell.For example, we have a file called TestFile.txt ... Read More

How to retrieve files and folders attributes using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 16-Oct-2020 09:20:11

2K+ Views

To retrieve files and folders attributes using PowerShell, you can use Get-Item or Get-ChildItem command. For example, We have a file called testfile.txt to get its attributes, PS C:\> Get-ChildItem C:\Temp\TestFile.txt |Select Name, Attributes Name Attributes ---- ... Read More

Advertisements