项目作者: devynspencer

项目描述 :
Automate sysadmin tasks.
高级语言: PowerShell
项目地址: git://github.com/devynspencer/powershell-sysadmin.git
创建时间: 2021-06-04T16:37:56Z
项目社区:https://github.com/devynspencer/powershell-sysadmin

开源协议:MIT License

下载


Sysadmin Module

Automate sysadmin tasks. Simplify work. Profit.

Configuration data

Much if not all of this module is intended to run off of JSON data describing an infrastructure. This provides a source-controllable, explicit record of how the infrastructure should look/work/function.

An example of what is in use currently:

  1. {
  2. "servers": [
  3. {
  4. "hostname": "srv01",
  5. "roles": [],
  6. "site": "Foxtrot"
  7. },
  8. {
  9. "hostname": "prn01",
  10. "roles": ["print"],
  11. "site": "Zulu"
  12. },
  13. {
  14. "hostname": "prn02",
  15. "roles": ["print"],
  16. "site": "Charlie"
  17. }
  18. ]
  19. }

Install

Install from GitHub source:

  1. git clone 'https://github.com/devynspencer/powershell-sysadmin'
  2. cd .\powershell-sysadmin

Repositories

Configure local NuGet feed for publishing and/or staging PowerShell modules:

  1. $RegisterParams = @{
  2. Name = 'Local'
  3. SourceLocation = 'C:\temp\packages\PowerShell'
  4. PublishLocation = 'C:\temp\packages\PowerShell'
  5. InstallationPolicy = 'Trusted'
  6. }
  7. Register-PSRepository @RegisterParams

Configure team NuGet feed for publishing PowerShell modules:

  1. $RegisterParams = @{
  2. Name = 'ExampleTeam'
  3. SourceLocation = '\\example.com\Packages\PowerShell\ExampleTeam'
  4. PublishLocation = '\\example.com\Packages\PowerShell\ExampleTeam'
  5. InstallationPolicy = 'Trusted'
  6. }
  7. Register-PSRepository @RegisterParams

Publish to local repository:

  1. $PublishParams = @{
  2. Path = '.\Sysadmin'
  3. Repository = 'Local'
  4. NuGetApiKey = ''
  5. }
  6. Publish-Module @PublishParams

Examples

  1. # Ensure the subdirectory is specified, not the project root
  2. $Path = "C:\Users\devyn\projects\powershell-sysadmin\Sysadmin"
  3. # Copy development PowerShell module from staging directory to local modules directory
  4. Deploy-ProjectModule -Path $Path -Verbose
  5. Import-Module MyProfile -Force -Verbose