Skip to content

Commit

Permalink
Removed Remove-UserFromLocalGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffpatton1971 committed Sep 14, 2020
1 parent 44dbe1a commit 781fafb
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 348 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Issue #44 Remove Get-LocalUserAccounts
- Issue #45 Remove New-LocalUser
- Issue #46 Remove Remove-LocalUser
- Issue #50 Remove Remove-UserFromLocalGroup

## [1.0.0.0] - 2020-09-13
### Added
Expand Down
21 changes: 10 additions & 11 deletions ComputerManagement/ComputerManagement.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,15 @@ Description = 'A PowerShell module for working with the local computer'
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'New-LocalUser', 'Set-Pass', 'Add-LocalUserToGroup',
'New-ScheduledTask', 'Remove-UserFromLocalGroup', 'Get-CimService',
'Get-NonStandardServiceAccount', 'Remove-LocalUser',
'Get-LocalUserAccounts', 'Get-PendingUpdates', 'Get-ServiceTag',
'Backup-EventLogs', 'Export-EventLog', 'Get-PaperCutLogs',
'Set-ShutdownMethod', 'Get-PrinterLogs', 'Get-OpenSessions',
'Get-OpenFiles', 'Get-RDPLoginEvents', 'Get-InvalidLogonAttempts',
'Get-MappedDrives', 'Get-DiskUsage', 'Get-Namespace', 'New-Password',
'Connect-Rdp', 'Get-NetShare', 'Get-WinEventTail', 'Open-CdDrive',
'Grant-RegistryPermission', 'New-Credential'
FunctionsToExport = 'Set-Pass', 'New-ScheduledTask', 'Get-CimService',
'Get-NonStandardServiceAccount', 'Get-PendingUpdates',
'Get-ServiceTag', 'Backup-EventLogs', 'Export-EventLog',
'Get-PaperCutLogs', 'Set-ShutdownMethod', 'Get-PrinterLogs',
'Get-OpenSessions', 'Get-OpenFiles', 'Get-RDPLoginEvents',
'Get-InvalidLogonAttempts', 'Get-MappedDrives', 'Get-DiskUsage',
'Get-Namespace', 'New-Password', 'Connect-Rdp', 'Get-NetShare',
'Get-WinEventTail', 'Open-CdDrive', 'Grant-RegistryPermission',
'New-Credential'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
Expand Down Expand Up @@ -122,7 +121,7 @@ PrivateData = @{
# ExternalModuleDependencies = ''

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
Expand Down
27 changes: 0 additions & 27 deletions ComputerManagement/ComputerManagement.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,6 @@ Function New-ScheduledTask {
Return $?
}
}
Function Remove-UserFromLocalGroup {
[CmdletBinding(HelpURI = 'https://github.com/mod-posh/ComputerManagement/blob/master/docs/Remove-UserFromLocalGroup.md#remove-userfromlocalgroup',
SupportsShouldProcess,
ConfirmImpact = 'Medium')]
Param
(
[Parameter(Mandatory = $true)]
[string]$ComputerName,
[Parameter(Mandatory = $true)]
[string]$UserName,
[Parameter(Mandatory = $true)]
[string]$GroupName
)
Begin {
}
Process {
if ($PSCmdlet.ShouldProcess("Remove", "Remove $($Username) from $($GroupName)")) {
$Computer = [ADSI]("WinNT://$($ComputerName)");
$User = [adsi]("WinNT://$ComputerName/$UserName, user")
$Group = $Computer.psbase.children.find($GroupName)
$Group.Remove("WinNT://$Computer/$User")
}
}
End {
Return $?
}
}
Function Get-CimService {
[CmdletBinding(HelpURI = 'https://github.com/mod-posh/ComputerManagement/blob/master/docs/Get-CimService.md#get-cimservice')]
Param
Expand Down
171 changes: 0 additions & 171 deletions ComputerManagement/en-us/ComputerManagement-help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2965,177 +2965,6 @@ Type : CD Drive</dev:code>
</maml:navigationLink>
</command:relatedLinks>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details>
<command:name>Remove-UserFromLocalGroup</command:name>
<command:verb>Remove</command:verb>
<command:noun>UserFromLocalGroup</command:noun>
<maml:description>
<maml:para>Removes a user/group from a local computer group.</maml:para>
</maml:description>
</command:details>
<maml:description>
<maml:para>This example removes a user from the local users group.</maml:para>
</maml:description>
<command:syntax>
<command:syntaxItem>
<maml:name>Remove-UserFromLocalGroup</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
<maml:name>ComputerName</maml:name>
<maml:Description>
<maml:para>{{ Fill ComputerName Description }}</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
<maml:name>UserName</maml:name>
<maml:Description>
<maml:para>{{ Fill UserName Description }}</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none">
<maml:name>GroupName</maml:name>
<maml:Description>
<maml:para>Name of the group where that the user/group is a member of.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf">
<maml:name>Confirm</maml:name>
<maml:Description>
<maml:para>Prompts you for confirmation before running the cmdlet.</maml:para>
</maml:Description>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi">
<maml:name>WhatIf</maml:name>
<maml:Description>
<maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para>
</maml:Description>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
<maml:name>ComputerName</maml:name>
<maml:Description>
<maml:para>{{ Fill ComputerName Description }}</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none">
<maml:name>GroupName</maml:name>
<maml:Description>
<maml:para>Name of the group where that the user/group is a member of.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
<maml:name>UserName</maml:name>
<maml:Description>
<maml:para>{{ Fill UserName Description }}</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf">
<maml:name>Confirm</maml:name>
<maml:Description>
<maml:para>Prompts you for confirmation before running the cmdlet.</maml:para>
</maml:Description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi">
<maml:name>WhatIf</maml:name>
<maml:Description>
<maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para>
</maml:Description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes />
<command:returnValues />
<maml:alertSet>
<maml:alert>
<maml:para>You will need to run this with either UAC disabled or from an elevated prompt.</maml:para>
</maml:alert>
</maml:alertSet>
<command:examples>
<command:example>
<maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
<dev:code>Remove-UserFromLocalGroup -ComputerName MyComputer -UserName RandomUser</dev:code>
<dev:remarks>
<maml:para>Description ----------- This example removes a user from the local administrators group.</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
<dev:code>Remove-UserFromLocalGroup -ComputerName MyComputer -UserName RandomUser -GroupName Users</dev:code>
<dev:remarks>
<maml:para></maml:para>
</dev:remarks>
</command:example>
</command:examples>
<command:relatedLinks>
<maml:navigationLink>
<maml:linkText>Online Version:</maml:linkText>
<maml:uri>https://github.com/mod-posh/ComputerManagement/blob/master/docs/Remove-UserFromLocalGroup.md#remove-userfromlocalgroup</maml:uri>
</maml:navigationLink>
<maml:navigationLink>
<maml:linkText>https://github.com/jeffpatton1971/mod-posh/wiki/ComputerManagement#Remove-UserFromLocalGroup</maml:linkText>
<maml:uri>https://github.com/jeffpatton1971/mod-posh/wiki/ComputerManagement#Remove-UserFromLocalGroup</maml:uri>
</maml:navigationLink>
</command:relatedLinks>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details>
<command:name>Set-Pass</command:name>
Expand Down
Binary file modified README.md
Binary file not shown.
8 changes: 2 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger: none
trigger:
- master

pool:
vmImage: 'windows-2019'
Expand Down
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions docs/ComputerManagement.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ Create a Scheduled Task on a computer.
### [Open-CdDrive](Open-CdDrive.md)
A function to eject the CD Drive

### [Remove-UserFromLocalGroup](Remove-UserFromLocalGroup.md)
Removes a user/group from a local computer group.

### [Set-Pass](Set-Pass.md)
Change the password of an existing user account.

Expand Down
Loading

0 comments on commit 781fafb

Please sign in to comment.