Git Product home page Git Product logo

pssharedgoods's Introduction

PSSharedGoods - PowerShell Module

PSSharedGoods is a little PowerShell Module that primary purpose is to be useful for multiple tasks, unrelated to each other. I've created this module as "a glue" between my other modules. I've noticed the more I build my modules, the more I use the same stuff and it became apparent I've two choices. Keep 3 or more versions of the same function across all my modules or export functions to separate module and bundle this module together. I chose the second option. This module currently is used by following modules

  • PSWriteWord - module to create Microsoft Word documents without Word being installed.
  • PSWriteExcel - cross-platform module to create Microsoft Excel documents without Excel being installed.
  • PSWinDocumentation - module to build documentation for Active Directory, Office 365 (Azure AD, Exchange Online), Exchange, Teams
  • PSWinReporting - module to create reports and provide monitoring of Security Events
  • PSAutomator - proof-of-concept module for onboarding, offboarding and business as usual
  • Many others - just review other GitHub projects of mine

More information can be found on a dedicated page for PSSharedGoods module.

Platform Status
Windows
Linux
MacOs

pssharedgoods's People

Contributors

danubie avatar diecknet avatar ferwe avatar m1kep avatar przemyslawklys avatar rmbolger avatar snd3r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pssharedgoods's Issues

ConvertFrom-ObjectToString: String generation enhancements

Hi,

I was starting to implement a helper to easier create "mock objects" for Pester tests from real world examples. I stumbled across "ConvertFrom-ObjectToString" which does much of the tasks I was looking for.

I would like to enhance the generated string to handle property values

  • that are $null
  • contain an array value
  • are hashtables
    in a simple fasion.

Before I create a PR I would like to understand the use case for the "$Object -is [System.Collections.IDictionary]" part.
Using my testcases, it will never get executed, because "$Object -is [Object]" already gets valid.
From my point of view, I would check for [IDictionary] before the more general "[Object]".

Can you tell me, how you use the 'IDictinionary'?

Best regards,
Wolfgang

error in PSSharedGoods.psd1 RequiredModules wrong version PSWriteColor

error in PSSharedGoods.psd1

RequiredModules = @(@{ModuleName = 'PSWriteColor'; GUID = '0b0ba5c5-ec85-4c2b-a718-874e55a8bc3f'; ModuleVersion = '0.87'; },
@{ModuleName = 'Connectimo'; GUID = 'e4f4f8a6-473e-4ba5-8166-480658c11421'; ModuleVersion = '0.0.5'; })

RequiredModules = @(@{ModuleName = 'PSWriteColor'; GUID = '0b0ba5c5-ec85-4c2b-a718-874e55a8bc3f'; ModuleVersion = '0.87.0'; },
@{ModuleName = 'Connectimo'; GUID = 'e4f4f8a6-473e-4ba5-8166-480658c11421'; ModuleVersion = '0.0.5'; })

I don't understand what I am doing wrong

The first time I open ISE I enter the get-module command, everything is clean, there are no extra modules. And if I enter the command Get-Module -ListAvailable, modules appear in the list immediately
Connectimo
PSSharedGoods
PSWriteColor
I don't understand what I did to make these modules load automatically

Get-WinADForestControllers via Remote PowerShell could have Issues with Get-ADForest

If you are using the Get-WinADForestControllers command via PSRemoting, it happened to me, that that i got the following erro:
Get-ADForest : Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services
running.

The issue is the Get-ADForest command within this function.
It can be solved, if the Get-ADForest command will be run with the Credential Parameter.

Because of this, I would like to add the Credential Parameter to the Get-WinADForestControllers command and pass this parameter to the Get-ADForest command.

I will create a pull request to fix this issue.

Add -Credentials for Get-Computer*

Hello,

I would like to know if you plan to add a -Credential parameters into the Get-Computer* CMDlets in a near future.
Indeed, when we work with trusted domain, we need sometimes to specify another account.

I ran some tests on my own with the Get-ComputerApplication and it works fine. But for others functions, it needs some work.
Before doing a PR, I would like to know your point of view.

Thanks

Add automated unit tests (using Pester)

Pester seems to be a good PowerShell testing library: https://github.com/pester/Pester

IMHO unit tests add to better code quality and ease refactoring, so you should consider this, IMHO.

The current tests are rather integration tests? Or they do not really use a library: https://github.com/EvotecIT/PSSharedGoods/blob/master/Public/TestFunctionality/Test-ComputerPort.ps1
Basically it seems to be for manual testing, but Pester can e.g even mock stuff, so it may be possible to test more stuff.

Found it on https://stackoverflow.com/questions/1004424/is-there-a-unit-testing-framework-for-testing-powershell-with-powershell-scripts?noredirect=1&lq=1

Update/donwload more modules at the same time

Helllo,

I'm using this code to download two modules:
Initialize-ModulePortable -Name 'ADEssentials' -Download -Path "$ScriptDirectory\Modules" Initialize-ModulePortable -Name 'PSWriteHTML' -Download -Path "$ScriptDirectory\Modules"
in the folder I get back this result
folder
:
If i look inside the ADEssentials.ps1 I see that there are all modules added.
PSWriteHTML.psd1
PSEventViewer.pds1
ADEssentials.psd1

Why the PSWriteHTML.psd1 is also added?
When I change the download order, this has no effect. Every time it is addes to the ADEssentials.psd1 file.
Correct me if I'm wrong, but normaly in this file only the module should be addes for the provides module??

Thanks.

Problem with Initialize-ModulePortable function - delets an important slash in some cases

When using PS normal console's auto-complete, the address that auto completed contains a slash at the end.
In this case, the function (in line 79 in "Initialize-ModulePortable.ps1") does a replace of $path (that includes '\' at its end) to $psscriptroot, that causes the final result to be without the slash after $psscriptroot.

For example, if I run this command:

Initialize-ModulePortable -Name FileSplitter -Path C:\Users\Me\Desktop\ -Download

The file that will be created will contain that:

$Modules = @(
   "$PSScriptRootfilesplitter\1.3\FileSplitter.psd1"
)
foreach ($_ in $Modules) {
   Import-Module $_ -Verbose:$false -Force
}

If I am right in my diagnosis, it can be fixed by checking if $Path contains a slash (or back-slash) at its end and delete it.

ConvertTo-FlatObject, DataType to String

Why do you convert the datatypes all to string?
Is it needed?

... Line 99
elseif ($Object.GetType().Name -in 'String', 'DateTime', 'TimeSpan', 'Version', 'Enum') {
$Object = $Object.ToString()
} elseif ($Depth)
...

Best Regards

NtpServerInterval flags defined incorrectly in Get-TimeSetttings

According to the NtpServer doc reference, the flags that can be associated with external NTP servers are:

0x01 SpecialInterval
0x02 UseAsFallbackOnly
0x04 SymmetricActive: For more information about this mode, see Windows Time Server.
0x08 Client

But the code defines them without the appropriate leading zero which breaks the string matching later in the function.

$NtpServerIntervals = @{
'0x1' = 'SpecialInterval' # flag indicate sync time with external server in special interval configured in “SpecialPollInterval” registry value.
'0x2' = 'UseAsFallbackOnly' # use this as UseAsFallbackOnly time source – if primary is not available then sync to this server.
'0x4' = 'SymmetricActive' #- For more information about this mode, see Windows Time Server: 3.3 Modes of Operation.
'0x8' = 'Client' #use client mode association while sync time to external time source.
'0x9' = 'SpecialInterval+Client' # use special interval + client mode association to external time source. This is a good value when your machine sync time to an external time source.
#'0x10' = 'Unknown'

So if NtpServer is set to a value like 0.pool.ntp.org,0x08 1.pool.ntp.org,0x08, it shows up as NtpServerIntervals : {Incorrect, Incorrect} instead of NtpServerIntervals : {Client, Client} in the function output.

As a tangential issue, these are bit flags that can be combined. So you may want to either change the code to interpret them as such, or include all combinations of the flags in the $NtpServerInterval definition like this:

$NtpServerIntervals = @{
    '0x01' = 'SpecialInterval'
    '0x02' = 'UseAsFallbackOnly'
    '0x03' = 'SpecialInterval+UseAsFallbackOnly'
    '0x04' = 'SymmetricActive'
    '0x05' = 'SpecialInterval+SymmetricActive'
    '0x06' = 'UseAsFallbackOnly+SymmetricActive'
    '0x07' = 'SpecialInterval+UseAsFallbackOnly+SymmetricActive'
    '0x08' = 'Client'
    '0x09' = 'SpecialInterval+Client'
    '0x0A' = 'UseAsFallbackOnly+Client'
    '0x0B' = 'SpecialInterval+UseAsFallbackOnly+Client'
    '0x0C' = 'SymmetricActive+Client'
    '0x0D' = 'SpecialInterval+SymmetricActive+Client'
    '0x0E' = 'UseAsFallbackOnly+SymmetricActive+Client'
    '0x0F' = 'SpecialInterval+UseAsFallbackOnly+SymmetricActive+Client'
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.