Skip to content

devynspencer/powershell-sysadmin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

{
  "servers": [
    {
      "hostname": "srv01",
      "roles": [],
      "site": "Foxtrot"
    },
    {
      "hostname": "prn01",
      "roles": ["print"],
      "site": "Zulu"
    },
    {
      "hostname": "prn02",
      "roles": ["print"],
      "site": "Charlie"
    }
  ]
}

Install

Install from GitHub source:

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

Repositories

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

$RegisterParams = @{
    Name = 'Local'
    SourceLocation = 'C:\temp\packages\PowerShell'
    PublishLocation = 'C:\temp\packages\PowerShell'
    InstallationPolicy = 'Trusted'
}

Register-PSRepository @RegisterParams

Configure team NuGet feed for publishing PowerShell modules:

$RegisterParams = @{
    Name = 'ExampleTeam'
    SourceLocation = '\\example.com\Packages\PowerShell\ExampleTeam'
    PublishLocation = '\\example.com\Packages\PowerShell\ExampleTeam'
    InstallationPolicy = 'Trusted'
}

Register-PSRepository @RegisterParams

Publish to local repository:

$PublishParams = @{
    Path = '.\Sysadmin'
    Repository = 'Local'
    NuGetApiKey = ''
}

Publish-Module @PublishParams

Examples

# Ensure the subdirectory is specified, not the project root
$Path = "C:\Users\devyn\projects\powershell-sysadmin\Sysadmin"

# Copy development PowerShell module from staging directory to local modules directory
Deploy-ProjectModule -Path $Path -Verbose

Import-Module MyProfile -Force -Verbose