AndrewPla / TOPdeskPS

PowerShell module to interact with the TOPdesk API
MIT License
30 stars 12 forks source link

Option to disable output after New-TdPerson #87

Closed whatthehomepod closed 5 years ago

whatthehomepod commented 5 years ago

Is your feature request related to a problem? Please describe. In my script to create users everything related to outputs, echo's are disabled. However New-TDPerson shows the user is created with all the information.

Is there a way to disable this?

Describe the solution you'd like Disable output.

Examples of how the solution would work New-TDPerson @NewTDSplat -output false

Describe alternatives you've considered n/a

Additional context n/a

ChrisLGardner commented 5 years ago

If you don't want any output showing on the screen then the PowerShell way to deal with this is to assign it to a variable, usually $null. You can also pipe to Out-Null or use stream redirection to null.

The alternative approach would be to instead add a -PassThru switch that would mean that without it then the output is suppressed but that would be a breaking change from previous versions. Being a breaking change is less of an issue when the major version number is 0 but still worth careful consideration as to if it's necessary.

whatthehomepod commented 5 years ago

If you don't want any output showing on the screen then the PowerShell way to deal with this is to assign it to a variable, usually $null. You can also pipe to Out-Null or use stream redirection to null.

The alternative approach would be to instead add a -PassThru switch that would mean that without it then the output is suppressed but that would be a breaking change from previous versions. Being a breaking change is less of an issue when the major version number is 0 but still worth careful consideration as to if it's necessary.

Something like New-TdPerson @NewTDSplat | Out-Null would do the trick?

ChrisLGardner commented 5 years ago

Yes that would work fine. You can also do $null = New-TdPerson @NewTDSplat for the same effect but a bit more performant (not a noticable issue unless you're creating a lot of users)

whatthehomepod commented 5 years ago

Thank you! :+1: Think Out-Null would be better, doesn't understand why you should add a variable to disable outputs ....