Housekeeping;Add prereq module installation
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		
							
								
								
									
										40
									
								
								scripts/Install-Prerequisites.ps1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								scripts/Install-Prerequisites.ps1
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | |||||||
|  | [CmdletBinding()] | ||||||
|  | Param( | ||||||
|  |     # No parameters | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | $RequiredPSModules = @( | ||||||
|  |     'ntobjectmanager'   # Provides cmdlet 'Set-ExecutionAlias' | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | $InstallPackageProviderSplat = @{ | ||||||
|  |     Name               = 'NuGet' | ||||||
|  |     MinimumVersion     = '2.8.5.201' | ||||||
|  |     Force              = $True | ||||||
|  |     Confirm            = $False | ||||||
|  | } | ||||||
|  | Install-PackageProvider @InstallPackageProviderSplat | ||||||
|  | $SetPSRepositorySplat = @{ | ||||||
|  |     Name               = 'PSGallery' | ||||||
|  |     InstallationPolicy = 'Trusted' | ||||||
|  | } | ||||||
|  | Set-PSRepository @SetPSRepositorySplat | ||||||
|  | $InstallModuleSplat = @{ | ||||||
|  |     Name               = $RequiredPSModules | ||||||
|  |     Force              = $True | ||||||
|  |     Confirm            = $False | ||||||
|  | } | ||||||
|  | Install-Module @InstallModuleSplat | ||||||
|  | $SetPSRepositorySplat = @{ | ||||||
|  |     Name               = 'PSGallery' | ||||||
|  |     InstallationPolicy = 'Untrusted' | ||||||
|  | } | ||||||
|  | Set-PSRepository @SetPSRepositorySplat | ||||||
|  |  | ||||||
|  | # Double check whether the required PowerShell modules are available | ||||||
|  | ForEach ($Module in $RequiredPSModules) { | ||||||
|  |     If ([boolean](Get-Module -Name $Module -ListAvailable) -ne $True) { | ||||||
|  |         Write-Error -Message "Missing PowerShell module '$($Module)'" | ||||||
|  |         Exit 1 | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | #Requires -Modules 'NtObjectManager' | ||||||
| [CmdletBinding()] | [CmdletBinding()] | ||||||
| Param( | Param( | ||||||
|     # None |     # None | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user