Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pipeline compatibility and fix output object types #45

Closed
scrthq opened this issue May 7, 2018 · 1 comment
Closed

Update pipeline compatibility and fix output object types #45

scrthq opened this issue May 7, 2018 · 1 comment
Assignees
Labels

Comments

@scrthq
Copy link
Member

scrthq commented May 7, 2018

PSGSuite already supports pipeline, but parts of it can be somewhat non-intuitive to use (i.e. piping Get-GSUser -Filter "IsAdmin -eq '$false'" | Update-GSUser -Suspended:$false would not actually unsuspend all the admins, as it would attempt to pass the entire User object and not just the PrimaryEmail)

Also, this will simultaneously remove the Select-Object calls after each object, instead using Add-Member to not break the object type.

All in all, here's what's planned:

  1. Replace Select-Object with Add-Member:
# From this...
$userObj | 
	Select-Object @{N = "User";E = {$User}},*

# To this...
$userObj | 
	Add-Member -MemberType NoteProperty -Name 'User' -Value $User -PassThru
  1. Override the built-in ToString() method on the object:
$userObj | 
	Add-Member -MemberType NoteProperty -Name 'User' -Value $User -PassThru  | 
	Add-Member -MemberType ScriptMethod -Name ToString -Value {$this.PrimaryEmail} -PassThru -Force
@scrthq scrthq added the bug label May 7, 2018
@scrthq scrthq self-assigned this May 7, 2018
scrthq added a commit that referenced this issue May 8, 2018
scrthq added a commit that referenced this issue May 8, 2018
…ck function

#### 2.6.0

* Added: `Compare-ModuleVersion` function to get latest installed version and compare against the latest version on the PSGallery ([Issue #44](#44))
* Fixed: Pipeline support, so you can do things like the following and get group, group member and user details (as an example) easily ([Issue #45](#45)):
```powershell
#much pipe
$users = Get-GSGroup $groupEmail -Verbose -OutVariable group | Get-GSGroupMember -Verbose -OutVariable members | Get-GSUser -Verbose

#contains the group's info
$group

#contains the group members' info
$members

#contains the group members' full user info
$users
```
@scrthq
Copy link
Member Author

scrthq commented May 8, 2018

updates deployed in v2.6.0

@scrthq scrthq closed this as completed May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant