SkylineAutomationToolkit.psm1
$PATHVER = ([environment]::OSVersion).platform switch ( $PATHVER ) { "Win32NT" { $PATHX = "C:\Program Files\WindowsPowerShell\Modules\SkylineAutomationToolkit\" } "Unix" { $PATHX = "~/.local/share/powershell/Modules/SkylineAutomationToolkit/" } } #$SATVER = (get-module SkylineAutomationToolkit).Version.tostring() #$SATVER = Get-ChildItem "C:\Program Files\WindowsPowerShell\Modules\SkylineAutomationToolkit\" -name $SATVER = Get-ChildItem "$PATHX" -name | select-object -last 1 . "$PATHX$SATVER\skyline-helper.ps1" . "$PATHX$SATVER\skyline-fixer.ps1" . "$PATHX$SATVER\skyline-docker.ps1" . "$PATHX$SATVER\skyline-comm.ps1" . "$PATHX$SATVER\skyline-sec.ps1" function tagset { $tagcatinfo = get-tagcategory skyline if ($tagcatinfo.Count -lt 1) { #create everything new-tagcategory skyline -cardinality "multiple" -description "Skyline Automation Toolkit" get-tagcategory skyline | new-tag SATversion -description "$SATVER" new-tagassignment -tag SATversion -entity Datacenters get-tagcategory skyline | new-tag SATusage -description "1" new-tagassignment -tag SATusage -entity Datacenters } else { #dont create $tagversion = get-tag SATversion if ($tagversion.description -ne "$SATVER") { get-tag SATversion | remove-tag -confirm:$false get-tagcategory skyline | new-tag SATversion -description "$SATVER" new-tagassignment -tag SATversion -entity Datacenters } $tagusage = get-tag SATusage $tagusagevalue = $tagusage.description $tagusagenum = [int]$tagusagevalue $tagusagenum2 = $tagusagenum + 1 get-tag SATusage | remove-tag -confirm:$false get-tagcategory skyline | new-tag SATusage -description "$tagusagenum2" new-tagassignment -tag SATusage -entity Datacenters } } function checkfile { $fileuname = '/usr/bin/uname' if (-not(Test-Path -Path $fileuname -PathType Leaf)) { $file = 'c:\skyline\SkylineUtils-config.ps1' } else { mkdir /skyline $file = '/skyline/SkylineUtils-config.ps1' } return $file } function createsource { $file = checkfile if (-not(Test-Path -Path $file -PathType Leaf)) { try { $null = New-Item -ItemType File -Path $file -Force -ErrorAction Stop } catch { throw $_.Exception.Message } } } Export-ModuleMember -Function 'skyline-fixer', 'skyline-helper', 'skyline-docker', 'skyline-comm', 'skyline-sec' |