Other stuff
This commit is contained in:
parent
c34cead304
commit
f5910782d4
@ -0,0 +1,113 @@
|
|||||||
|
<Query Kind="Program" />
|
||||||
|
|
||||||
|
public static Dictionary<string,int> WeightedList = new Dictionary<string,int>();
|
||||||
|
void Main()
|
||||||
|
{
|
||||||
|
var r1 = new Regex(@"<#.+?#>", RegexOptions.Singleline);
|
||||||
|
var r2 = new Regex("#.+?[\r|\n]");
|
||||||
|
|
||||||
|
var directoryPath = Path.Combine(GetExecutingDirectory(),"Modules");
|
||||||
|
|
||||||
|
var di = new DirectoryInfo(directoryPath);
|
||||||
|
var files = di.GetFiles("*.ps1",SearchOption.AllDirectories);
|
||||||
|
var functionNames = new List<string>();
|
||||||
|
var excludeNames = new List<string>{"Module", "profile", "Shredded Function Names", "ShredModules", "VariableDeclarations", "ConfigurationValues", "chocolateybeforemodify", "chocolateyInstall", "chocolateyUninstall"};
|
||||||
|
var d = new Dictionary<string, HashSet<string>>();
|
||||||
|
var df = files.Select(x => {
|
||||||
|
var fm = new FolderModule();
|
||||||
|
fm.FunctionName = Path.GetFileNameWithoutExtension(x.FullName);
|
||||||
|
var pathParent = x.Directory;
|
||||||
|
fm.PublicPrivate = x.Directory.Name;
|
||||||
|
fm.ModuleName = x.Directory.Parent.Name;
|
||||||
|
return fm;
|
||||||
|
}).Where(x => !excludeNames.Contains(x.FunctionName) && x.FunctionName.IndexOf(".Test", StringComparison.OrdinalIgnoreCase) < 0).Distinct().ToDictionary(x => x.FunctionName, x => x);
|
||||||
|
var fmod = new FolderModule();
|
||||||
|
fmod.FunctionName = "Alkami.Ops.Common";
|
||||||
|
fmod.PublicPrivate = "OPS";
|
||||||
|
fmod.ModuleName = "Alkami.Ops.Common";
|
||||||
|
df.Add(fmod.FunctionName,fmod);
|
||||||
|
|
||||||
|
fmod = new FolderModule();
|
||||||
|
fmod.FunctionName = "Alkami.Ops.SecretServer";
|
||||||
|
fmod.PublicPrivate = "OPS";
|
||||||
|
fmod.ModuleName = "Alkami.Ops.SecretServer";
|
||||||
|
df.Add(fmod.FunctionName,fmod);
|
||||||
|
|
||||||
|
//df.Where(x => !new[]{"Public","Private"}.Contains(x.Value.PublicPrivate)).Dump();
|
||||||
|
//df.Where(x => new[]{"Public","Private"}.Contains(x.Value.PublicPrivate)).Dump();
|
||||||
|
|
||||||
|
// Dictionary<ModuleName,Dictionary<FileName,HashSet<ModuleName>>>
|
||||||
|
var fd = new Dictionary<string,Dictionary<string,HashSet<string>>>();
|
||||||
|
foreach(var file in files) {
|
||||||
|
var fileName = Path.GetFileNameWithoutExtension(file.FullName);
|
||||||
|
if (excludeNames.Contains(fileName) || fileName.IndexOf(".Test", StringComparison.OrdinalIgnoreCase) >= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var moduleName = file.Directory.Parent.Name;
|
||||||
|
if (!d.ContainsKey(moduleName)) {
|
||||||
|
d.Add(moduleName, new HashSet<string>());
|
||||||
|
}
|
||||||
|
if (!fd.ContainsKey(moduleName)) {
|
||||||
|
fd.Add(moduleName, new Dictionary<string,HashSet<string>>());
|
||||||
|
}
|
||||||
|
var text = r2.Replace(r1.Replace(File.ReadAllText(file.FullName),""), "");
|
||||||
|
foreach (var kvp in df) {
|
||||||
|
if (text.Contains(kvp.Key) && kvp.Value.ModuleName != moduleName) {
|
||||||
|
if (!fd[moduleName].ContainsKey(fileName)) {
|
||||||
|
fd[moduleName].Add(fileName, new HashSet<string>());
|
||||||
|
}
|
||||||
|
if (kvp.Value.PublicPrivate.ToUpper() == "PRIVATE") {
|
||||||
|
fd[moduleName][fileName].Add("!!PRIVATE - " + kvp.Value.ModuleName + " - " + kvp.Value.FunctionName);
|
||||||
|
} else if (kvp.Value.PublicPrivate.ToUpper() == "OPS" && !moduleName.ToUpper().Contains("DEVOPS")) {
|
||||||
|
fd[moduleName][fileName].Add("!!OPS - " + kvp.Value.ModuleName + " - " + kvp.Value.FunctionName);
|
||||||
|
} else {
|
||||||
|
fd[moduleName][fileName].Add(kvp.Value.ModuleName);
|
||||||
|
}
|
||||||
|
d[moduleName].Add(kvp.Value.ModuleName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// d.Dump();
|
||||||
|
foreach(var kvp in d) {
|
||||||
|
$"{kvp.Key}".Dump();
|
||||||
|
kvp.Value.ToList().ForEach(x => $" {x}".Dump());
|
||||||
|
"".Dump();
|
||||||
|
}
|
||||||
|
|
||||||
|
"".Dump();
|
||||||
|
"===============================================".Dump();
|
||||||
|
"".Dump();
|
||||||
|
|
||||||
|
foreach(var kvp in fd) {
|
||||||
|
$"{kvp.Key}".Dump();
|
||||||
|
foreach(var kkvp in kvp.Value) {
|
||||||
|
$" {kkvp.Key}".Dump();
|
||||||
|
kkvp.Value.ToList().ForEach(x => $" {x}".Dump());
|
||||||
|
}
|
||||||
|
"".Dump();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
I need to know that a given module has a dependency on another module.
|
||||||
|
I start with the file.Directory.Parent.Name as the module. I then find each file in that folder, and check all lines to match each item in the list.
|
||||||
|
If any line matches any key:
|
||||||
|
add the module dependency from the value.ModuleName for that key to the list under the module
|
||||||
|
continue to the next line
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FolderModule {
|
||||||
|
public string ModuleName {get;set;}
|
||||||
|
public string PublicPrivate {get;set;}
|
||||||
|
public string FunctionName {get;set;}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int CalculateWeightedValue(Dictionary<string,string> inputs, string key) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetExecutingDirectory()
|
||||||
|
{
|
||||||
|
return Path.GetDirectoryName (Util.CurrentQueryPath);
|
||||||
|
}
|
23
Modules/Cole.PowerShell.Developer/TODO/test-flagstate.ps1
Normal file
23
Modules/Cole.PowerShell.Developer/TODO/test-flagstate.ps1
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
clear
|
||||||
|
|
||||||
|
Function Test-FlagState {
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param([Parameter(Mandatory = $false)][Alias("Force")][switch]$forceUpdate)
|
||||||
|
process {
|
||||||
|
Write-Host "forceUpdate flag was set to $forceUpdate and IsPresent evaluates to $($forceUpdate.IsPresent)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test-FlagState -forceUpdate:"Tomato"
|
||||||
|
# Test-FlagState -forceUpdate:(!!"Tomato")
|
||||||
|
# Test-FlagState -forceUpdate:(!!"")
|
||||||
|
|
||||||
|
# Test-FlagState -forceUpdate:$true
|
||||||
|
# Test-FlagState -forceUpdate:$false
|
||||||
|
# Test-FlagState -forceUpdate
|
||||||
|
# Test-FlagState
|
||||||
|
# Test-FlagState -forceUpdate:$null
|
||||||
|
|
||||||
|
Set-Alias TFS Test-FlagState -Force -Scope:Global
|
||||||
|
|
||||||
|
|
233
Story Files/SRE-12016.md
Normal file
233
Story Files/SRE-12016.md
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
# Highlight of major changes of note
|
||||||
|
|
||||||
|
The majority of the code review for SRE-12016 has a lot of touched files that may not be strictly relevant to the pull request. There are some files that were touched and some new files that I want to review in detail.
|
||||||
|
|
||||||
|
### General notes
|
||||||
|
|
||||||
|
#### Touched files
|
||||||
|
|
||||||
|
Several files were touched for reformatting while reading, reformatting per code-review request, removal of module-loading (changed the psd1 to match), TODO leavings so we can continue to refactor with targeted review of TODO blocks, etc. I also changed function parameters for things like `Position` or `Mandatory` flags in cases where it caused further issues during unit tests.
|
||||||
|
|
||||||
|
I added some build-solution changes that meant touching a lot of `.tests.ps1` files.
|
||||||
|
|
||||||
|
#### ServerManager
|
||||||
|
|
||||||
|
One of my goals of this refactoring was to get us off Microsoft.Web.Administration.ServerManager. While this does expose some excellent functionality that we can definitely use, one thing it isn't is super-future-proofed. While my replacements are also somewhat bound to the same concepts as the use of ServerManager, I am trying to move in the direction of functions-per-need. This allows for better testing by mockability. To mock ServerManager already requires something like this:
|
||||||
|
|
||||||
|
Function Mock-ServerManager {
|
||||||
|
Write-Host "Creating our custom mock object";
|
||||||
|
|
||||||
|
$applications = @(
|
||||||
|
@{
|
||||||
|
Path = "/Mockable";
|
||||||
|
PhysicalPath = "C:\";
|
||||||
|
ApplicationPoolName = "Mockable";
|
||||||
|
EnabledProtocols = "http";
|
||||||
|
Attributes = @{
|
||||||
|
preloadEnabled = @{
|
||||||
|
Value = "True"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
@{
|
||||||
|
Path = "/Mockable2";
|
||||||
|
PhysicalPath = "C:\";
|
||||||
|
ApplicationPoolName = "Mockable";
|
||||||
|
EnabledProtocols = "http";
|
||||||
|
Attributes = @{
|
||||||
|
preloadEnabled = @{
|
||||||
|
Value = "True"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Add-Member -InputObject $applications -MemberType ScriptMethod -Name Add -Value {
|
||||||
|
Param($path, $physicalPath)
|
||||||
|
return @{
|
||||||
|
Path = $path;
|
||||||
|
PhysicalPath = $physicalPath;
|
||||||
|
ApplicationPoolName = "";
|
||||||
|
EnabledProtocols = "";
|
||||||
|
Attributes = @{
|
||||||
|
preloadEnabled = @{
|
||||||
|
Value = "False"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} -Force $mgr = New-Object PSObject -Property @{ Sites = @{"Default Web Site" = @{Applications = $applications}}}
|
||||||
|
|
||||||
|
Add-Member -InputObject $mgr -MemberType ScriptMethod -Name CommitChanges -Value {}
|
||||||
|
Add-Member -InputObject $mgr -MemberType ScriptMethod -Name Dispose -Value { param() Write-Host "Disposing";return;}
|
||||||
|
|
||||||
|
return $mgr
|
||||||
|
}
|
||||||
|
|
||||||
|
Maintaining something like this with more complexity for all functionality and testing is going to grow more painful as time goes on. Switching to simple-functions is a goal we should all strive for.
|
||||||
|
|
||||||
|
We should work to modify as many functions as use the ServerManager object to use these functions as possible for further testability work and eventual replacement/auditing:
|
||||||
|
|
||||||
|
1. Get-ServerManager
|
||||||
|
2. Save-IISServerManagerChange
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Get-MachineConfigAppSetting
|
||||||
|
|
||||||
|
[Get-MachineConfigAppSetting.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.Common/Public/Get-MachineConfigAppSetting.ps1) is being deprecated in favor of Get-AppSetting. The warnings here are for TeamCity so we can find, isolate and update those settings in other places. Nobody knows for sure why we can't move to this pattern, so we are doing so. This touches a few files (I can put together a list if needed) that aren't directly related to the requirement of the ticket, but code reviews indicated the discrepancy and added to a request for the change.
|
||||||
|
|
||||||
|
## Get-AppServiceAccountName
|
||||||
|
|
||||||
|
[Get-AppServiceAccountName.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.Configuration/Public/Get-AppServiceAccountName.ps1) This is to reduce our need for magic variables by environments. This replaces Set-AppTierGMSAAccounts when we get the bootstrap fully implemented on all servers. See [SRE-12325](https://jira.alkami.com/browse/SRE-12325) for more details here. We can use this in Set-AlkamiWebAppPoolConfiguration (see below for more discussion) to automatically put in a user credential without having to predefine it in a global array.
|
||||||
|
|
||||||
|
> This function is basically the linchpin of the auto-configuration of Set-AlkamiWebAppPoolConfiguration on the Legacy ORB applications.
|
||||||
|
|
||||||
|
## Set-AlkamiWebAppPoolConfiguration
|
||||||
|
|
||||||
|
[Set-AlkamiWebAppPoolConfiguration.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/Set-AlkamiWebAppPoolConfiguration.ps1) for user configuration setting as everything uses AD GMSA credentials. This function does self-healing of application pool configurations, so while it may cause additional disk churn, it fixes any aberrant configurations of existing functionality and ensures consistency throughout the application.
|
||||||
|
|
||||||
|
Set-AllAppPoolDefaults can be converted to use this new functionality as well, reducing repeated complexity.
|
||||||
|
|
||||||
|
One of the setbacks of this function, especially when referring to general notes above, is that there is a lack of explicit testability around $appCmdPath. This could also be extracted into a function that would improve testability. In the interests of not-overloading the complexity of this pull request I left this inline, but a simple pair of functions would improve testability of these functions:
|
||||||
|
|
||||||
|
if (!(& $appCmdPath list apppool $property | Where-Object { $_ -match $AppPoolName })) {
|
||||||
|
|
||||||
|
could be replaced with
|
||||||
|
|
||||||
|
Function Get-AppCommandPropertyExistsOnAppPoool {
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Mandatory=$true, Position=0)]
|
||||||
|
[Alias("Name")]
|
||||||
|
[string]$property,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true, Position=1)]
|
||||||
|
[ref]$AppPoolName
|
||||||
|
)
|
||||||
|
|
||||||
|
## Replace with a call to a function to find this in the right place
|
||||||
|
$appCmdPath = (Join-Path $env:systemroot "\system32\inetsrv\appcmd.exe")
|
||||||
|
|
||||||
|
$returnValue = $false
|
||||||
|
|
||||||
|
$propertiesFoundOn = @(& $appCmdPath list apppool $property)
|
||||||
|
|
||||||
|
foreach($propertyReturned in $propertiesFoundOn) {
|
||||||
|
if ($propertyReturned -match $AppPoolName) {
|
||||||
|
$returnValue = $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $returnValue
|
||||||
|
}
|
||||||
|
|
||||||
|
and this is the paired replacement:
|
||||||
|
|
||||||
|
(& $appCmdPath set apppool $AppPoolName $property) | Out-Null
|
||||||
|
|
||||||
|
Function Set-AppCommandPropertyOnAppPoool {
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Mandatory=$true, Position=0)]
|
||||||
|
[Alias("Name")]
|
||||||
|
[string]$property,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true, Position=1)]
|
||||||
|
[ref]$AppPoolName
|
||||||
|
)
|
||||||
|
|
||||||
|
## Replace with a call to a function to find this in the right place
|
||||||
|
$appCmdPath = (Join-Path $env:systemroot "\system32\inetsrv\appcmd.exe")
|
||||||
|
|
||||||
|
(& $appCmdPath set apppool $AppPoolName $property) | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
> The main holdup on using this as a bulk replacement option is the lack of support for Get-AppServiceAccountName
|
||||||
|
> However, this can still be used today without that functionality, we just have to maintain setting the value of the service account information elsewhere.
|
||||||
|
|
||||||
|
## Set-CommonApplicationPoolOptions
|
||||||
|
|
||||||
|
[Set-CommonApplicationPoolOptions.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/Set-CommonApplicationPoolOptions.ps1) Any use of this function should be replaced with a call to Set-AlkamiWebAppPoolConfiguration.ps1 as this function is now just a very thing wrapper around that.
|
||||||
|
|
||||||
|
## New-AppTierApplicationPools
|
||||||
|
|
||||||
|
[New-AppTierApplicationPools.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/New-AppTierApplicationPools.ps1)
|
||||||
|
|
||||||
|
The guts of this function were moved to New-AppTierApplicationPool to help get Set-CommonApplicationPoolOptions and Set-AlkamiWebAppPoolConfiguration to the right place. This function should be removed if we adopt Install-AlkamiWebApplication overall.
|
||||||
|
|
||||||
|
> Implementing this also means drastically simplifying the global:AppTierApplications
|
||||||
|
|
||||||
|
## New-AppTierApplicationPool
|
||||||
|
|
||||||
|
[New-AppTierApplicationPool.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/New-AppTierApplicationPool.ps1) This function was a rip from the middle of New-AppTierApplicationPools so that we could focus on replacing the internals and ensure we have consistent behavior on the replacement function. See also (links below) New-AppTierWebApplication/New-AppTierWebApplications and New-WebTierWebApplications which was just internals bulk-replaced with the call to Install-AlkamiWebApplication.
|
||||||
|
|
||||||
|
I didn't force-replace the AppTier changes like I did on the WebTier because I wanted more group buy-in before I force that.
|
||||||
|
|
||||||
|
If we push the changes for New-AppTierWebApplications to use Install-AlkamiWebApplication instead, then we can just get rid of all calls to New-AppTierApplicationPools entirely, as the Install-AlkamiWebApplication creates or updates (self-heals) the app pool for that service as it runs.
|
||||||
|
|
||||||
|
New-AppTierApplicationPool should be converted to use the new functionality in Set-AlkamiWebAppPoolConfiguration
|
||||||
|
|
||||||
|
> Note the conversion to a PSCredential parameter
|
||||||
|
|
||||||
|
## New-AppTierWebApplications
|
||||||
|
|
||||||
|
[New-AppTierWebApplications.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/New-AppTierWebApplications.ps1)
|
||||||
|
|
||||||
|
The internals of this function should be moved to Install-AlkamiWebApplication. The holdup is the lack of configurable credentials.
|
||||||
|
|
||||||
|
## New-WebTierWebApplications
|
||||||
|
|
||||||
|
[New-WebTierWebApplications.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/New-WebTierWebApplications.ps1)
|
||||||
|
|
||||||
|
This just wholesale calls Install-AlkamiWebApplication under the hood because there is no GMSA account associated with any web-tier applications, and that is the majority holdup on making the changes above.
|
||||||
|
|
||||||
|
## Install-AlkamiWebApplication
|
||||||
|
|
||||||
|
[Install-AlkamiWebApplication.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/Install-AlkamiWebApplication.ps1) This is the brute of the story.
|
||||||
|
|
||||||
|
Basically, the intent is that we can install existing Legacy ORB applications (ex: BankService) with the same installer we use for standalone WebApplications (ex: CUFX, Iodine). This function will allow us to install some applications (ex: CUFX) to chocolatey and link into ORB shared as appropriate, and will allow us to register the Legacy ORB applications using C:\Orb with the same functionality. This reduces the cross-system complexity we've used in the past with multiple functions duplicating effort in part or in whole, and gives us a single point of failure for all installs. If we decide that we need to change a specific feature for AppPools or WebApplications, we can do so in these new consolidated files.
|
||||||
|
|
||||||
|
# Lesser function changes/additions
|
||||||
|
|
||||||
|
## New-DefaultWebsite
|
||||||
|
## Optimize-DefaultWebsite
|
||||||
|
|
||||||
|
[New-DefaultWebsite.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/New-DefaultWebsite.ps1) This function serves to create a Default Web Site but it can be used to create any website. The use of New-Website conflicts with the Microsoft WebAdministration functions, so we should avoid using their names.
|
||||||
|
|
||||||
|
> We could rename this to New-AlkamiWebsite.
|
||||||
|
|
||||||
|
If we replace New-WebSite with New-DefaultWebsite (New-AlkamiWebsite?) we should copy over the certificate functionality (which is why this wasn't merged to that function).
|
||||||
|
|
||||||
|
See also Set-WebTierDefaultWebSite, New-IPSTSWebSite, etc
|
||||||
|
|
||||||
|
[Optimize-DefaultWebsite.ps1](https://bitbucket.corp.alkamitech.com/projects/DEVOPS/repos/alkami.powershell/pull-requests/336/diff#Modules/Alkami.PowerShell.IIS/Public/Optimize-DefaultWebsite.ps1)
|
||||||
|
|
||||||
|
> We could rename this to Optimize-AlkamiWebsite.
|
||||||
|
|
||||||
|
## Install-WebApplication
|
||||||
|
|
||||||
|
This name may be confusing with Install-AlkamiWebApplication but this name matches the naming convention of the other installers:
|
||||||
|
|
||||||
|
1. Install-Widget
|
||||||
|
2. Install-Provider
|
||||||
|
3. Install-WebExtension
|
||||||
|
|
||||||
|
## New-WebBinding
|
||||||
|
|
||||||
|
This can be drastically cleaned up as Get-AlkamiWebAppPool and New-AlkamiWebAppPool are just aliases to Set-AlkamiWebAppPoolConfiguration which is the new guts of Set-CommonApplicationPoolOptions. This triple-alias for Get/New/Set was that they all did precisely the same work (save new-when-not-exists, but the function this replaces does that too, so this is existing behavior)
|
||||||
|
|
||||||
|
# Potential removal of functions on final adoption wholesale
|
||||||
|
|
||||||
|
> This requires the presence of Environment.UserPrefix on all app tier servers in the fleet.
|
||||||
|
|
||||||
|
Remove:
|
||||||
|
|
||||||
|
1. New-AppTierApplicationPools
|
||||||
|
2. New-AppTierApplicationPool
|
||||||
|
3. New-AppTierWebApplication
|
||||||
|
4. Set-CommonApplicationPoolOptions
|
||||||
|
5. Get-MachineConfigAppSetting
|
||||||
|
6. Set-AppTierGMSAAccounts (just re-run Set-AlkamiWebAppPoolConfiguration)
|
||||||
|
7. New-WebSite
|
||||||
|
8. Set-AllAppPoolDefaults (just re-run Set-AlkamiWebAppPoolConfiguration/Optimize-DefaultWebsite)
|
||||||
|
9. Set-ApplicationPoolExecutionAccount
|
431
Story Files/SRE-12392.linq
Normal file
431
Story Files/SRE-12392.linq
Normal file
File diff suppressed because one or more lines are too long
126
Story Files/SRE-12392.md
Normal file
126
Story Files/SRE-12392.md
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
# How to use Test-ModuleInclusion
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
FolderPath - Where to find the modules. Ex: Z:\git\devops_powershell\Modules
|
||||||
|
FailBuild - A switch to fail the build if things are broken
|
||||||
|
|
||||||
|
Assuming your repository path locally is Z:\git\devops_powershell\, this is what you would type to run this command
|
||||||
|
|
||||||
|
PS Z:\git\devops_powershell> cd Modules
|
||||||
|
PS Z:\git\devops_powershell\Modules> . .\.build\Test-ModuleInclusion.ps1
|
||||||
|
PS Z:\git\devops_powershell\Modules> Test-ModuleInclusion (Resolve-Path .\)
|
||||||
|
|
||||||
|
|
||||||
|
And this is the output you would expect to see from an initial run (before we fix things)
|
||||||
|
|
||||||
|
|
||||||
|
testing solution
|
||||||
|
Did not match [SecretServerConnection.ps1] as a valid filename.
|
||||||
|
Found a CS Project for Alkami.Ops.Certificates
|
||||||
|
Found a CS Project for Alkami.Ops.Common
|
||||||
|
Found a CS Project for Alkami.Ops.SecretServer
|
||||||
|
Did not match [IsPackageWidget.ps1] as a valid filename.
|
||||||
|
Found a CS Project for Alkami.PowerShell.Migrations
|
||||||
|
|
||||||
|
======================
|
||||||
|
|
||||||
|
Alkami.DevOps.Certificates uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Alkami.PowerShell.Services
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
* Alkami.PowerShell.IIS
|
||||||
|
|
||||||
|
Alkami.DevOps.Common uses
|
||||||
|
* Alkami.PowerShell.Common - WARNING - OBVIOUS CYCLE
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
* Alkami.DevOps.Certificates
|
||||||
|
|
||||||
|
Alkami.DevOps.Installation uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Alkami.DevOps.Common
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
* Alkami.PowerShell.AD
|
||||||
|
* Alkami.PowerShell.IIS
|
||||||
|
* Alkami.PowerShell.Services
|
||||||
|
* Alkami.DevOps.Certificates
|
||||||
|
|
||||||
|
Alkami.DevOps.Inventory uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Alkami.PowerShell.Choco - WARNING - OBVIOUS CYCLE
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
* Alkami.PowerShell.ServiceFabric
|
||||||
|
* Alkami.DevOps.Certificates
|
||||||
|
|
||||||
|
Alkami.DevOps.Operations uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Carbon
|
||||||
|
* Alkami.PowerShell.IIS
|
||||||
|
* Alkami.PowerShell.Services
|
||||||
|
* Alkami.PowerShell.AD
|
||||||
|
* Alkami.PowerShell.Choco
|
||||||
|
* Alkami.DevOps.Common
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
|
||||||
|
Alkami.DevOps.SqlReports uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
* Alkami.DevOps.Common
|
||||||
|
|
||||||
|
Alkami.Ops.Certificates doesn't have additional-module usage
|
||||||
|
|
||||||
|
Alkami.Ops.Common doesn't have additional-module usage
|
||||||
|
|
||||||
|
Alkami.Ops.SecretServer doesn't have additional-module usage
|
||||||
|
|
||||||
|
Alkami.PowerShell.AD uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
|
||||||
|
Alkami.PowerShell.Choco uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Carbon
|
||||||
|
* Alkami.PowerShell.Services
|
||||||
|
* Alkami.PowerShell.AD
|
||||||
|
* Alkami.PowerShell.ServiceFabric - WARNING - OBVIOUS CYCLE
|
||||||
|
* Alkami.DevOps.Inventory - WARNING - SOMETHING REQUIRES A HIGHER-ORDER-FUNCTION
|
||||||
|
* !! Install-FailedChocoPackages calls Get-PlatformElementInventory
|
||||||
|
|
||||||
|
Alkami.PowerShell.Common uses
|
||||||
|
* Alkami.PowerShell.Configuration - WARNING - OBVIOUS CYCLE
|
||||||
|
* Alkami.DevOps.Common - WARNING - SOMETHING REQUIRES A HIGHER-ORDER-FUNCTION
|
||||||
|
* !! Set-AppSetting calls ConvertTo-SafeTeamCityMessage
|
||||||
|
|
||||||
|
Alkami.PowerShell.Configuration uses
|
||||||
|
* Alkami.PowerShell.Common - WARNING - OBVIOUS CYCLE
|
||||||
|
|
||||||
|
Alkami.PowerShell.Database uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
|
||||||
|
Alkami.PowerShell.IIS uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Carbon
|
||||||
|
* WebAdministration
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
* Alkami.PowerShell.Services
|
||||||
|
|
||||||
|
Alkami.PowerShell.Migrations doesn't have additional-module usage
|
||||||
|
|
||||||
|
Alkami.PowerShell.ServerManagement uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Alkami.PowerShell.Services
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
|
||||||
|
Alkami.PowerShell.ServiceFabric uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Alkami.DevOps.Common - WARNING - SOMETHING REQUIRES A HIGHER-ORDER-FUNCTION
|
||||||
|
* !! Get-AlkamiServiceFabricHostnamesByTag calls Get-DesignationTagNameByEnvironment
|
||||||
|
* !! Get-AlkamiServiceFabricHostnamesByTag calls Get-InstancesByTag
|
||||||
|
* Alkami.PowerShell.Choco - WARNING - OBVIOUS CYCLE
|
||||||
|
* Alkami.PowerShell.Configuration
|
||||||
|
* Carbon
|
||||||
|
|
||||||
|
Alkami.PowerShell.Services uses
|
||||||
|
* Alkami.PowerShell.Common
|
||||||
|
* Alkami.PowerShell.AD
|
||||||
|
* Alkami.PowerShell.Configuration
|
405
Story Files/SRE-12392.ps1
Normal file
405
Story Files/SRE-12392.ps1
Normal file
File diff suppressed because one or more lines are too long
35
Story Files/SRE-12955.linq
Normal file
35
Story Files/SRE-12955.linq
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<Query Kind="Program" />
|
||||||
|
|
||||||
|
void Main()
|
||||||
|
{
|
||||||
|
var sw = new Stopwatch();
|
||||||
|
sw.Start();
|
||||||
|
var foundFunctions = new Dictionary<string,List<string>>();
|
||||||
|
|
||||||
|
var directoryPath = Path.Combine(GetExecutingDirectory(),@"..\Modules");
|
||||||
|
|
||||||
|
var listOfWords = File.ReadAllLines(Path.Combine(GetExecutingDirectory(),"SRE-12955.txt"));
|
||||||
|
|
||||||
|
var listOfFiles = new DirectoryInfo(Path.Combine(GetExecutingDirectory(),@"..\Modules")).EnumerateFiles("*.ps1",SearchOption.AllDirectories).ToList();
|
||||||
|
|
||||||
|
foreach(var file in listOfFiles) {
|
||||||
|
var text = File.ReadAllText(file.FullName);
|
||||||
|
foreach (var word in listOfWords) {
|
||||||
|
if (text.IndexOf(word) > -1) {
|
||||||
|
if (!foundFunctions.ContainsKey(file.FullName)) {
|
||||||
|
foundFunctions.Add(file.FullName, new List<string>());
|
||||||
|
}
|
||||||
|
foundFunctions[file.FullName].Add(word);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sw.Stop();
|
||||||
|
sw.Dump();
|
||||||
|
foundFunctions.Dump();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetExecutingDirectory()
|
||||||
|
{
|
||||||
|
return Path.GetDirectoryName(Util.CurrentQueryPath);
|
||||||
|
}
|
6693
Story Files/SRE-12955.txt
Normal file
6693
Story Files/SRE-12955.txt
Normal file
File diff suppressed because it is too large
Load Diff
59
Story Files/SRE-18111.ps1
Normal file
59
Story Files/SRE-18111.ps1
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
$teamcityFolders = Get-ChildItem -Path C:\CloneAll\DevOps\.teamcity -Directory -Recurse -Depth 4
|
||||||
|
$fileMap = @{}
|
||||||
|
|
||||||
|
foreach ($teamcityFolder in $teamcityFolders) {
|
||||||
|
Set-Location -Path (Split-Path -Path $teamcityFolder.FullName -Parent)
|
||||||
|
git reset --hard
|
||||||
|
git checkout main
|
||||||
|
git checkout master
|
||||||
|
git pull origin
|
||||||
|
}
|
||||||
|
|
||||||
|
Set-Location -Path C:\CloneAll
|
||||||
|
Start-Transcript -Path "z:\temp\SRE-18111.txt"
|
||||||
|
|
||||||
|
foreach ($teamcityFolder in $teamcityFolders) {
|
||||||
|
$xmlFilesPath = Join-Path -Path $teamcityFolder.FullName -ChildPath "*.xml"
|
||||||
|
$xmlFiles = Get-ChildItem -Path $xmlFilesPath -File -Recurse
|
||||||
|
foreach ($xmlFile in $xmlFiles) {
|
||||||
|
$file = [xml](Get-Content -Path $xmlFile.FullName -Raw)
|
||||||
|
$uuid = $file.ChildNodes[1].uuid
|
||||||
|
|
||||||
|
if ($null -eq $uuid) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($null -eq $fileMap.$uuid) {
|
||||||
|
$fileMap.$uuid = @()
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileMap.$uuid += @{ Name = $file.ChildNodes[1].name; Path = $xmlFile.FullName; FileName = $xmlFile.Name; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($key in $fileMap.Keys) {
|
||||||
|
if ($fileMap.$key.Count -gt 1) {
|
||||||
|
Write-Host "Distinct uuid: $key"
|
||||||
|
$groups = $fileMap.$key.Name | Group-Object
|
||||||
|
if (@($groups).Count -eq 1) {
|
||||||
|
Write-Host "`tFound one distinct name for all of the following files: $($groups[0].Name)"
|
||||||
|
} else {
|
||||||
|
Write-Host "`tFound multiple names for the following files"
|
||||||
|
foreach ($group in $groups) {
|
||||||
|
Write-Host "`t * $($group.Name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$groups = $fileMap.$key.FileName | Group-Object
|
||||||
|
if (@($groups).Count -eq 1) {
|
||||||
|
Write-Host "`tFound one distinct filename for all of the following files: $($groups[0].Name)"
|
||||||
|
} else {
|
||||||
|
Write-Host "`tFound multiple filenames for the following files"
|
||||||
|
foreach ($group in $groups) {
|
||||||
|
Write-Host "`t * $($group.Name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Write-Host "`t`t$($fileMap.$key.Path -join "`n`t`t")"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Stop-Transcript
|
11
Story Files/SRE-18111.txt
Normal file
11
Story Files/SRE-18111.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
The related ps1 file is for finding the cross-repo duplicate uuids and printing them out to a file.
|
||||||
|
|
||||||
|
Note that C:\CloneAll\DevOps\.teamcity is a hardcoded reference to a folder called C:\CloneAll\DevOps\ that has all of the DEVOPS repos in BitBucket in the folder.
|
||||||
|
|
||||||
|
Note that C:\CloneAll is a hard coded path
|
||||||
|
|
||||||
|
Note that z:\temp\SRE-18111.txt is a hardcoded path for output
|
||||||
|
|
||||||
|
If you have all of the DEVOPS projects (at least the TeamCity ones that have a folder on the root called .teamcity) then you can change the appropriate three paths above and run the script and it does all the work you want.
|
||||||
|
|
||||||
|
Otherwise, you may need to edit more than those three paths
|
458
Story Files/carbon_finder.ps1
Normal file
458
Story Files/carbon_finder.ps1
Normal file
@ -0,0 +1,458 @@
|
|||||||
|
$carbonFuncs = @( "Add-CGroupMember",
|
||||||
|
"Add-CIisDefaultDocument",
|
||||||
|
"Add-CTrustedHost",
|
||||||
|
"Add-GroupMember",
|
||||||
|
"Add-GroupMembers",
|
||||||
|
"Add-IisDefaultDocument",
|
||||||
|
"Add-TrustedHost",
|
||||||
|
"Add-TrustedHosts",
|
||||||
|
"Assert-AdminPrivilege",
|
||||||
|
"Assert-AdminPrivileges",
|
||||||
|
"Assert-CAdminPrivilege",
|
||||||
|
"Assert-CFirewallConfigurable",
|
||||||
|
"Assert-CService",
|
||||||
|
"Assert-FirewallConfigurable",
|
||||||
|
"Assert-Service",
|
||||||
|
"Clear-CDscLocalResourceCache",
|
||||||
|
"Clear-CMofAuthoringMetadata",
|
||||||
|
"Clear-CTrustedHost",
|
||||||
|
"Clear-DscLocalResourceCache",
|
||||||
|
"Clear-MofAuthoringMetadata",
|
||||||
|
"Clear-TrustedHost",
|
||||||
|
"Clear-TrustedHosts",
|
||||||
|
"Complete-CJob",
|
||||||
|
"Complete-Job",
|
||||||
|
"Complete-Jobs",
|
||||||
|
"Compress-CItem",
|
||||||
|
"Compress-Item",
|
||||||
|
"Convert-CSecureStringToString",
|
||||||
|
"Convert-CXmlFile",
|
||||||
|
"Convert-SecureStringToString",
|
||||||
|
"Convert-XmlFile",
|
||||||
|
"ConvertFrom-Base64",
|
||||||
|
"ConvertFrom-CBase64",
|
||||||
|
"ConvertTo-Base64",
|
||||||
|
"ConvertTo-CBase64",
|
||||||
|
"ConvertTo-CContainerInheritanceFlags",
|
||||||
|
"ConvertTo-CInheritanceFlag",
|
||||||
|
"ConvertTo-CPropagationFlag",
|
||||||
|
"ConvertTo-CSecurityIdentifier",
|
||||||
|
"ConvertTo-ContainerInheritanceFlags",
|
||||||
|
"ConvertTo-FullPath",
|
||||||
|
"ConvertTo-InheritanceFlag",
|
||||||
|
"ConvertTo-InheritanceFlags",
|
||||||
|
"ConvertTo-PropagationFlag",
|
||||||
|
"ConvertTo-PropagationFlags",
|
||||||
|
"ConvertTo-SecurityIdentifier",
|
||||||
|
"Copy-CDscResource",
|
||||||
|
"Copy-DscResource",
|
||||||
|
"Disable-AclInheritance",
|
||||||
|
"Disable-CAclInheritance",
|
||||||
|
"Disable-CFirewallStatefulFtp",
|
||||||
|
"Disable-CIEEnhancedSecurityConfiguration",
|
||||||
|
"Disable-CIisSecurityAuthentication",
|
||||||
|
"Disable-CNtfsCompression",
|
||||||
|
"Disable-FirewallStatefulFtp",
|
||||||
|
"Disable-IEEnhancedSecurityConfiguration",
|
||||||
|
"Disable-IisSecurityAuthentication",
|
||||||
|
"Disable-NtfsCompression",
|
||||||
|
"Enable-AclInheritance",
|
||||||
|
"Enable-CAclInheritance",
|
||||||
|
"Enable-CFirewallStatefulFtp",
|
||||||
|
"Enable-CIEActivationPermission",
|
||||||
|
"Enable-CIisDirectoryBrowsing",
|
||||||
|
"Enable-CIisSecurityAuthentication",
|
||||||
|
"Enable-CIisSsl",
|
||||||
|
"Enable-CNtfsCompression",
|
||||||
|
"Enable-FirewallStatefulFtp",
|
||||||
|
"Enable-IEActivationPermission",
|
||||||
|
"Enable-IEActivationPermissions",
|
||||||
|
"Enable-IisDirectoryBrowsing",
|
||||||
|
"Enable-IisSecurityAuthentication",
|
||||||
|
"Enable-IisSsl",
|
||||||
|
"Enable-NtfsCompression",
|
||||||
|
"Expand-CItem",
|
||||||
|
"Expand-Item",
|
||||||
|
"Find-ADUser",
|
||||||
|
"Find-CADUser",
|
||||||
|
"Format-ADSearchFilterValue",
|
||||||
|
"Format-ADSpecialCharacters",
|
||||||
|
"Format-CADSearchFilterValue",
|
||||||
|
"Get-ADDomainController",
|
||||||
|
"Get-CADDomainController",
|
||||||
|
"Get-CCertificate",
|
||||||
|
"Get-CCertificateStore",
|
||||||
|
"Get-CComPermission",
|
||||||
|
"Get-CComSecurityDescriptor",
|
||||||
|
"Get-CDscError",
|
||||||
|
"Get-CDscWinEvent",
|
||||||
|
"Get-CFileShare",
|
||||||
|
"Get-CFileSharePermission",
|
||||||
|
"Get-CFirewallRule",
|
||||||
|
"Get-CGroup",
|
||||||
|
"Get-CHttpUrlAcl",
|
||||||
|
"Get-CIPAddress",
|
||||||
|
"Get-CIisAppPool",
|
||||||
|
"Get-CIisApplication",
|
||||||
|
"Get-CIisConfigurationSection",
|
||||||
|
"Get-CIisHttpHeader",
|
||||||
|
"Get-CIisHttpRedirect",
|
||||||
|
"Get-CIisMimeMap",
|
||||||
|
"Get-CIisSecurityAuthentication",
|
||||||
|
"Get-CIisVersion",
|
||||||
|
"Get-CIisWebsite",
|
||||||
|
"Get-CMsi",
|
||||||
|
"Get-CMsmqMessageQueue",
|
||||||
|
"Get-CMsmqMessageQueuePath",
|
||||||
|
"Get-CPathProvider",
|
||||||
|
"Get-CPathToHostsFile",
|
||||||
|
"Get-CPerformanceCounter",
|
||||||
|
"Get-CPermission",
|
||||||
|
"Get-CPowerShellModuleInstallPath",
|
||||||
|
"Get-CPowershellPath",
|
||||||
|
"Get-CPrivilege",
|
||||||
|
"Get-CProgramInstallInfo",
|
||||||
|
"Get-CRegistryKeyValue",
|
||||||
|
"Get-CScheduledTask",
|
||||||
|
"Get-CServiceAcl",
|
||||||
|
"Get-CServiceConfiguration",
|
||||||
|
"Get-CServicePermission",
|
||||||
|
"Get-CServiceSecurityDescriptor",
|
||||||
|
"Get-CSslCertificateBinding",
|
||||||
|
"Get-CTrustedHost",
|
||||||
|
"Get-CUser",
|
||||||
|
"Get-CWmiLocalUserAccount",
|
||||||
|
"Get-Certificate",
|
||||||
|
"Get-CertificateStore",
|
||||||
|
"Get-ComPermission",
|
||||||
|
"Get-ComPermissions",
|
||||||
|
"Get-ComSecurityDescriptor",
|
||||||
|
"Get-DscError",
|
||||||
|
"Get-DscWinEvent",
|
||||||
|
"Get-FileShare",
|
||||||
|
"Get-FileSharePermission",
|
||||||
|
"Get-FirewallRule",
|
||||||
|
"Get-FirewallRules",
|
||||||
|
"Get-Group",
|
||||||
|
"Get-HttpUrlAcl",
|
||||||
|
"Get-IPAddress",
|
||||||
|
"Get-IisAppPool",
|
||||||
|
"Get-IisApplication",
|
||||||
|
"Get-IisConfigurationSection",
|
||||||
|
"Get-IisHttpHeader",
|
||||||
|
"Get-IisHttpRedirect",
|
||||||
|
"Get-IisMimeMap",
|
||||||
|
"Get-IisSecurityAuthentication",
|
||||||
|
"Get-IisVersion",
|
||||||
|
"Get-IisWebsite",
|
||||||
|
"Get-Msi",
|
||||||
|
"Get-MsmqMessageQueue",
|
||||||
|
"Get-MsmqMessageQueuePath",
|
||||||
|
"Get-PathCanonicalCase",
|
||||||
|
"Get-PathProvider",
|
||||||
|
"Get-PathToHostsFile",
|
||||||
|
"Get-PerformanceCounter",
|
||||||
|
"Get-PerformanceCounters",
|
||||||
|
"Get-Permission",
|
||||||
|
"Get-Permissions",
|
||||||
|
"Get-PowerShellModuleInstallPath",
|
||||||
|
"Get-PowershellPath",
|
||||||
|
"Get-Privilege",
|
||||||
|
"Get-Privileges",
|
||||||
|
"Get-ProgramInstallInfo",
|
||||||
|
"Get-RegistryKeyValue",
|
||||||
|
"Get-ScheduledTask",
|
||||||
|
"Get-ServiceAcl",
|
||||||
|
"Get-ServiceConfiguration",
|
||||||
|
"Get-ServicePermission",
|
||||||
|
"Get-ServicePermissions",
|
||||||
|
"Get-ServiceSecurityDescriptor",
|
||||||
|
"Get-SslCertificateBinding",
|
||||||
|
"Get-SslCertificateBindings",
|
||||||
|
"Get-TrustedHost",
|
||||||
|
"Get-TrustedHosts",
|
||||||
|
"Get-User",
|
||||||
|
"Get-WmiLocalUserAccount",
|
||||||
|
"Grant-CComPermission",
|
||||||
|
"Grant-CHttpUrlPermission",
|
||||||
|
"Grant-CMsmqMessageQueuePermission",
|
||||||
|
"Grant-CPermission",
|
||||||
|
"Grant-CPrivilege",
|
||||||
|
"Grant-CServiceControlPermission",
|
||||||
|
"Grant-CServicePermission",
|
||||||
|
"Grant-ComPermission",
|
||||||
|
"Grant-ComPermissions",
|
||||||
|
"Grant-HttpUrlPermission",
|
||||||
|
"Grant-MsmqMessageQueuePermission",
|
||||||
|
"Grant-MsmqMessageQueuePermissions",
|
||||||
|
"Grant-Permission",
|
||||||
|
"Grant-Permissions",
|
||||||
|
"Grant-Privilege",
|
||||||
|
"Grant-ServiceControlPermission",
|
||||||
|
"Grant-ServicePermission",
|
||||||
|
"Initialize-CLcm",
|
||||||
|
"Initialize-Lcm",
|
||||||
|
"Install-CCertificate",
|
||||||
|
"Install-CDirectory",
|
||||||
|
"Install-CFileShare",
|
||||||
|
"Install-CGroup",
|
||||||
|
"Install-CIisAppPool",
|
||||||
|
"Install-CIisApplication",
|
||||||
|
"Install-CIisVirtualDirectory",
|
||||||
|
"Install-CIisWebsite",
|
||||||
|
"Install-CJunction",
|
||||||
|
"Install-CMsi",
|
||||||
|
"Install-CMsmq",
|
||||||
|
"Install-CMsmqMessageQueue",
|
||||||
|
"Install-CPerformanceCounter",
|
||||||
|
"Install-CRegistryKey",
|
||||||
|
"Install-CScheduledTask",
|
||||||
|
"Install-CService",
|
||||||
|
"Install-CUser",
|
||||||
|
"Install-Certificate",
|
||||||
|
"Install-Directory",
|
||||||
|
"Install-FileShare",
|
||||||
|
"Install-Group",
|
||||||
|
"Install-IisAppPool",
|
||||||
|
"Install-IisApplication",
|
||||||
|
"Install-IisVirtualDirectory",
|
||||||
|
"Install-IisWebsite",
|
||||||
|
"Install-Junction",
|
||||||
|
"Install-Msi",
|
||||||
|
"Install-Msmq",
|
||||||
|
"Install-MsmqMessageQueue",
|
||||||
|
"Install-PerformanceCounter",
|
||||||
|
"Install-RegistryKey",
|
||||||
|
"Install-ScheduledTask",
|
||||||
|
"Install-Service",
|
||||||
|
"Install-SmbShare",
|
||||||
|
"Install-User",
|
||||||
|
"Invoke-AppCmd",
|
||||||
|
"Invoke-CAppCmd",
|
||||||
|
"Invoke-CPowerShell",
|
||||||
|
"Invoke-PowerShell",
|
||||||
|
"Invoke-WindowsInstaller",
|
||||||
|
"Join-CIisVirtualPath",
|
||||||
|
"Join-IisVirtualPath",
|
||||||
|
"Lock-CIisConfigurationSection",
|
||||||
|
"Lock-IisConfigurationSection",
|
||||||
|
"New-CCredential",
|
||||||
|
"New-CJunction",
|
||||||
|
"New-CRsaKeyPair",
|
||||||
|
"New-CTempDirectory",
|
||||||
|
"New-Credential",
|
||||||
|
"New-Junction",
|
||||||
|
"New-RsaKeyPair",
|
||||||
|
"New-TempDir",
|
||||||
|
"New-TempDirectory",
|
||||||
|
"Protect-Acl",
|
||||||
|
"Protect-CString",
|
||||||
|
"Protect-String",
|
||||||
|
"Read-CFile",
|
||||||
|
"Read-File",
|
||||||
|
"Remove-CDotNetAppSetting",
|
||||||
|
"Remove-CEnvironmentVariable",
|
||||||
|
"Remove-CGroupMember",
|
||||||
|
"Remove-CHostsEntry",
|
||||||
|
"Remove-CIisMimeMap",
|
||||||
|
"Remove-CIniEntry",
|
||||||
|
"Remove-CJunction",
|
||||||
|
"Remove-CRegistryKeyValue",
|
||||||
|
"Remove-CSslCertificateBinding",
|
||||||
|
"Remove-Certificate",
|
||||||
|
"Remove-DotNetAppSetting",
|
||||||
|
"Remove-EnvironmentVariable",
|
||||||
|
"Remove-GroupMember",
|
||||||
|
"Remove-HostsEntry",
|
||||||
|
"Remove-IisMimeMap",
|
||||||
|
"Remove-IisWebsite",
|
||||||
|
"Remove-IniEntry",
|
||||||
|
"Remove-Junction",
|
||||||
|
"Remove-MsmqMessageQueue",
|
||||||
|
"Remove-RegistryKeyValue",
|
||||||
|
"Remove-Service",
|
||||||
|
"Remove-SslCertificateBinding",
|
||||||
|
"Remove-User",
|
||||||
|
"Reset-CHostsFile",
|
||||||
|
"Reset-CMsmqQueueManagerID",
|
||||||
|
"Reset-HostsFile",
|
||||||
|
"Reset-MsmqQueueManagerID",
|
||||||
|
"Resolve-CFullPath",
|
||||||
|
"Resolve-CIdentity",
|
||||||
|
"Resolve-CIdentityName",
|
||||||
|
"Resolve-CNetPath",
|
||||||
|
"Resolve-CPathCase",
|
||||||
|
"Resolve-CRelativePath",
|
||||||
|
"Resolve-FullPath",
|
||||||
|
"Resolve-Identity",
|
||||||
|
"Resolve-IdentityName",
|
||||||
|
"Resolve-NetPath",
|
||||||
|
"Resolve-PathCase",
|
||||||
|
"Resolve-RelativePath",
|
||||||
|
"Restart-CRemoteService",
|
||||||
|
"Restart-RemoteService",
|
||||||
|
"Revoke-CComPermission",
|
||||||
|
"Revoke-CHttpUrlPermission",
|
||||||
|
"Revoke-CPermission",
|
||||||
|
"Revoke-CPrivilege",
|
||||||
|
"Revoke-CServicePermission",
|
||||||
|
"Revoke-ComPermission",
|
||||||
|
"Revoke-ComPermissions",
|
||||||
|
"Revoke-HttpUrlPermission",
|
||||||
|
"Revoke-Permission",
|
||||||
|
"Revoke-Privilege",
|
||||||
|
"Revoke-ServicePermission",
|
||||||
|
"Set-CDotNetAppSetting",
|
||||||
|
"Set-CDotNetConnectionString",
|
||||||
|
"Set-CEnvironmentVariable",
|
||||||
|
"Set-CHostsEntry",
|
||||||
|
"Set-CIisHttpHeader",
|
||||||
|
"Set-CIisHttpRedirect",
|
||||||
|
"Set-CIisMimeMap",
|
||||||
|
"Set-CIisWebsiteID",
|
||||||
|
"Set-CIisWebsiteSslCertificate",
|
||||||
|
"Set-CIisWindowsAuthentication",
|
||||||
|
"Set-CIniEntry",
|
||||||
|
"Set-CRegistryKeyValue",
|
||||||
|
"Set-CServiceAcl",
|
||||||
|
"Set-CSslCertificateBinding",
|
||||||
|
"Set-CTrustedHost",
|
||||||
|
"Set-DotNetAppSetting",
|
||||||
|
"Set-DotNetConnectionString",
|
||||||
|
"Set-EnvironmentVariable",
|
||||||
|
"Set-HostsEntry",
|
||||||
|
"Set-IisHttpHeader",
|
||||||
|
"Set-IisHttpRedirect",
|
||||||
|
"Set-IisMimeMap",
|
||||||
|
"Set-IisWebsiteID",
|
||||||
|
"Set-IisWebsiteSslCertificate",
|
||||||
|
"Set-IisWindowsAuthentication",
|
||||||
|
"Set-IniEntry",
|
||||||
|
"Set-RegistryKeyValue",
|
||||||
|
"Set-ServiceAcl",
|
||||||
|
"Set-SslCertificateBinding",
|
||||||
|
"Set-TrustedHost",
|
||||||
|
"Set-TrustedHosts",
|
||||||
|
"Split-CIni",
|
||||||
|
"Split-Ini",
|
||||||
|
"Start-CDscPullConfiguration",
|
||||||
|
"Start-DscPullConfiguration",
|
||||||
|
"Test-AdminPrivilege",
|
||||||
|
"Test-AdminPrivileges",
|
||||||
|
"Test-CAdminPrivilege",
|
||||||
|
"Test-CDotNet",
|
||||||
|
"Test-CDscTargetResource",
|
||||||
|
"Test-CFileShare",
|
||||||
|
"Test-CFirewallStatefulFtp",
|
||||||
|
"Test-CGroup",
|
||||||
|
"Test-CGroupMember",
|
||||||
|
"Test-CIPAddress",
|
||||||
|
"Test-CIdentity",
|
||||||
|
"Test-CIisAppPool",
|
||||||
|
"Test-CIisConfigurationSection",
|
||||||
|
"Test-CIisSecurityAuthentication",
|
||||||
|
"Test-CIisWebsite",
|
||||||
|
"Test-CMsmqMessageQueue",
|
||||||
|
"Test-CNtfsCompression",
|
||||||
|
"Test-COSIs32Bit",
|
||||||
|
"Test-COSIs64Bit",
|
||||||
|
"Test-CPathIsJunction",
|
||||||
|
"Test-CPerformanceCounter",
|
||||||
|
"Test-CPerformanceCounterCategory",
|
||||||
|
"Test-CPermission",
|
||||||
|
"Test-CPowerShellIs32Bit",
|
||||||
|
"Test-CPowerShellIs64Bit",
|
||||||
|
"Test-CPrivilege",
|
||||||
|
"Test-CRegistryKeyValue",
|
||||||
|
"Test-CScheduledTask",
|
||||||
|
"Test-CService",
|
||||||
|
"Test-CSslCertificateBinding",
|
||||||
|
"Test-CTypeDataMember",
|
||||||
|
"Test-CUncPath",
|
||||||
|
"Test-CUser",
|
||||||
|
"Test-CWindowsFeature",
|
||||||
|
"Test-CZipFile",
|
||||||
|
"Test-DotNet",
|
||||||
|
"Test-DscTargetResource",
|
||||||
|
"Test-FileShare",
|
||||||
|
"Test-FirewallStatefulFtp",
|
||||||
|
"Test-Group",
|
||||||
|
"Test-GroupMember",
|
||||||
|
"Test-IPAddress",
|
||||||
|
"Test-Identity",
|
||||||
|
"Test-IisAppPool",
|
||||||
|
"Test-IisAppPoolExists",
|
||||||
|
"Test-IisConfigurationSection",
|
||||||
|
"Test-IisSecurityAuthentication",
|
||||||
|
"Test-IisWebsite",
|
||||||
|
"Test-IisWebsiteExists",
|
||||||
|
"Test-MsmqMessageQueue",
|
||||||
|
"Test-NtfsCompression",
|
||||||
|
"Test-OSIs32Bit",
|
||||||
|
"Test-OSIs64Bit",
|
||||||
|
"Test-PathIsJunction",
|
||||||
|
"Test-PerformanceCounter",
|
||||||
|
"Test-PerformanceCounterCategory",
|
||||||
|
"Test-Permission",
|
||||||
|
"Test-PowerShellIs32Bit",
|
||||||
|
"Test-PowerShellIs64Bit",
|
||||||
|
"Test-Privilege",
|
||||||
|
"Test-RegistryKeyValue",
|
||||||
|
"Test-ScheduledTask",
|
||||||
|
"Test-Service",
|
||||||
|
"Test-SslCertificateBinding",
|
||||||
|
"Test-TypeDataMember",
|
||||||
|
"Test-UncPath",
|
||||||
|
"Test-User",
|
||||||
|
"Test-WindowsFeature",
|
||||||
|
"Test-ZipFile",
|
||||||
|
"Uninstall-CCertificate",
|
||||||
|
"Uninstall-CDirectory",
|
||||||
|
"Uninstall-CFileShare",
|
||||||
|
"Uninstall-CGroup",
|
||||||
|
"Uninstall-CIisAppPool",
|
||||||
|
"Uninstall-CIisWebsite",
|
||||||
|
"Uninstall-CJunction",
|
||||||
|
"Uninstall-CMsmqMessageQueue",
|
||||||
|
"Uninstall-CPerformanceCounterCategory",
|
||||||
|
"Uninstall-CScheduledTask",
|
||||||
|
"Uninstall-CService",
|
||||||
|
"Uninstall-CUser",
|
||||||
|
"Uninstall-Certificate",
|
||||||
|
"Uninstall-Directory",
|
||||||
|
"Uninstall-FileShare",
|
||||||
|
"Uninstall-Group",
|
||||||
|
"Uninstall-IisAppPool",
|
||||||
|
"Uninstall-IisWebsite",
|
||||||
|
"Uninstall-Junction",
|
||||||
|
"Uninstall-MsmqMessageQueue",
|
||||||
|
"Uninstall-PerformanceCounterCategory",
|
||||||
|
"Uninstall-ScheduledTask",
|
||||||
|
"Uninstall-Service",
|
||||||
|
"Uninstall-User",
|
||||||
|
"Unlock-CIisConfigurationSection",
|
||||||
|
"Unlock-IisConfigurationSection",
|
||||||
|
"Unprotect-AclAccessRules",
|
||||||
|
"Unprotect-CString",
|
||||||
|
"Unprotect-String",
|
||||||
|
"Write-CDscError",
|
||||||
|
"Write-CFile",
|
||||||
|
"Write-DscError",
|
||||||
|
"Write-File" )
|
||||||
|
|
||||||
|
#$allPSM1s = Get-ChildItem "D:/alkami.powershell/modules/" -Filter "*.psm1" -Recurse
|
||||||
|
$allPSM1s = Get-ChildItem "D:/" -Filter "*.ps1" -Recurse
|
||||||
|
foreach ($psm1 in $allPSM1s) {
|
||||||
|
foreach ($line in (get-content $psm1.FullName)) {
|
||||||
|
foreach ($carbonFunc in $carbonFuncs) {
|
||||||
|
if ($line -like "## Function from *") {
|
||||||
|
Continue
|
||||||
|
}
|
||||||
|
if ($line -like "*$carbonFunc*") {
|
||||||
|
Write-Host "$carbonFunc : $($psm1.FullName) : $line"
|
||||||
|
} else {
|
||||||
|
# write-host "." -nonewline
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5
build.ps1
Normal file
5
build.ps1
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.\modules\build-solution.ps1 -fast
|
||||||
|
|
||||||
|
.\package.ps1 -clean
|
||||||
|
|
||||||
|
.\install.ps1
|
41
install.ps1
Normal file
41
install.ps1
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
$chocoPath = (Join-Path $PSScriptRoot "choco")
|
||||||
|
|
||||||
|
## See notes below
|
||||||
|
$DEVOPS_Modules_ChocoOutputPathKey = "DEVOPS_Modules_ChocoOutputPath"
|
||||||
|
$DEVOPS_Modules_ChocoOutputPath = [System.Environment]::GetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "User")
|
||||||
|
if (!([string]::IsNullOrEmpty($DEVOPS_Modules_ChocoOutputPath))) {
|
||||||
|
$chocoPath = $DEVOPS_Modules_ChocoOutputPath
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path $chocoPath)) {
|
||||||
|
(New-Item $chocoPath -ItemType Directory -Force) | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$nupkgs = (Get-ChildItem $chocoPath *.nupkg -Recurse)
|
||||||
|
|
||||||
|
$pwd = Get-Location
|
||||||
|
|
||||||
|
cd $chocoPath
|
||||||
|
|
||||||
|
foreach ($nupkg in $nupkgs) {
|
||||||
|
choco upgrade $nupkg -yf
|
||||||
|
}
|
||||||
|
|
||||||
|
Set-Location $pwd
|
||||||
|
|
||||||
|
<#
|
||||||
|
|
||||||
|
If you want to override the address where these files are built-produced-to, add this to your profile:
|
||||||
|
C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
|
||||||
|
|
||||||
|
and update the target folder (in this case z:\choco)
|
||||||
|
|
||||||
|
$DEVOPS_Modules_ChocoOutputPathKey = "DEVOPS_Modules_ChocoOutputPath"
|
||||||
|
$DEVOPS_Modules_ChocoOutputPath = [System.Environment]::GetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "User")
|
||||||
|
if ([string]::IsNullOrEmpty($DEVOPS_Modules_ChocoOutputPath)) {
|
||||||
|
[System.Environment]::SetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "Z:\choco", "User")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#>
|
52
package.ps1
Normal file
52
package.ps1
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
param([switch]$clean)
|
||||||
|
|
||||||
|
$chocoPath = (Join-Path $PSScriptRoot "choco")
|
||||||
|
|
||||||
|
## See notes below
|
||||||
|
$DEVOPS_Modules_ChocoOutputPathKey = "DEVOPS_Modules_ChocoOutputPath"
|
||||||
|
$DEVOPS_Modules_ChocoOutputPath = [System.Environment]::GetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "User")
|
||||||
|
if (!([string]::IsNullOrEmpty($DEVOPS_Modules_ChocoOutputPath))) {
|
||||||
|
$chocoPath = $DEVOPS_Modules_ChocoOutputPath
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path $chocoPath)) {
|
||||||
|
(New-Item $chocoPath -ItemType Directory -Force) | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($clean) {
|
||||||
|
Remove-Item -Path $chocoPath\*.nupkg -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$nuspecPaths = (Get-ChildItem *.nuspec -Recurse)
|
||||||
|
|
||||||
|
foreach ($nuspecPath in $nuspecPaths) {
|
||||||
|
$folderPath = (Split-Path $nuspecPath);
|
||||||
|
$psdPath = (Join-Path $folderPath "*.psd1");
|
||||||
|
if (!(Test-Path $psdPath)) { continue; }
|
||||||
|
|
||||||
|
Write-Output "";
|
||||||
|
Write-Output "";
|
||||||
|
Write-Output "Packaging $folderPath";
|
||||||
|
|
||||||
|
$version = (((Get-Content $psdPath) | ? { $_.Trim().StartsWith('ModuleVersion') }) -split '=')[1].Trim().Replace("'","")
|
||||||
|
|
||||||
|
choco pack $nuspecPath --version $version --out $chocoPath
|
||||||
|
Write-Output "=================";
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
|
||||||
|
If you want to override the address where these files are built-produced-to, add this to your profile:
|
||||||
|
C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
|
||||||
|
|
||||||
|
and update the target folder (in this case z:\choco)
|
||||||
|
|
||||||
|
$DEVOPS_Modules_ChocoOutputPathKey = "DEVOPS_Modules_ChocoOutputPath"
|
||||||
|
$DEVOPS_Modules_ChocoOutputPath = [System.Environment]::GetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "User")
|
||||||
|
if ([string]::IsNullOrEmpty($DEVOPS_Modules_ChocoOutputPath)) {
|
||||||
|
[System.Environment]::SetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "Z:\choco", "User")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#>
|
Loading…
Reference in New Issue
Block a user