full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Core/SubscriptionSecurity/RBAC.ps1
RBAC.ps1
using namespace Microsoft.Azure.Commands.Resources.Models.Authorization using namespace System.Management.Automation Set-StrictMode -Version Latest # Class to implement Subscription RBAC controls class RBAC: CommandBase { hidden [SubscriptionRBAC] $Policy = $null; hidden [PSRoleAssignment[]] $RoleAss...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Core/SubscriptionSecurity/SecurityCenter.ps1
SecurityCenter.ps1
using namespace System.Management.Automation Set-StrictMode -Version Latest class SecurityCenter: AzSdkRoot { [PSObject] $Policy = $null; [string] $Off = "Off"; [string] $On = "On"; SecurityCenter([string] $subscriptionId): Base($subscriptionId) { $this.Policy = $this.LoadServerConf...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Configurations/ContinuousAssurance/Continuous_Assurance_Runbook.ps1
Continuous_Assurance_Runbook.ps1
function Set-Modules { param( [System.Collections.IDictionary] $ModuleList, [string[]] $SyncModuleList ) $ModuleList.Keys | ForEach-Object{ $ModuleName = $_ $ModuleVersion = $ModuleList.Item($_) $Module = Get-AzureRmAutomationModule ` -ResourceGroupName $AutomationAccount...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Managers/ControlStateExtension.ps1
ControlStateExtension.ps1
Set-StrictMode -Version Latest class ControlStateExtension { hidden [PSObject] $AzSDKResourceGroup = $null; hidden [PSObject] $AzSDKStorageAccount = $null; hidden [PSObject] $AzSDKStorageContainer = $null; hidden [PSObject] $ControlStateIndexer = $null; hidden [int] $HasControlStateReadPermissions = -1; ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Managers/ConfigurationManager.ps1
ConfigurationManager.ps1
Set-StrictMode -Version Latest # # ConfigManager.ps1 # class ConfigurationManager { hidden static [AzSdkConfig] GetAzSdkConfigData() { return [AzSdkConfig]::GetInstance([ConfigurationManager]::GetAzSdkSettings().UseOnlinePolicyStore, [ConfigurationManager]::GetAzSdkSettings().OnlinePolicySt...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/ListenerHelper.ps1
ListenerHelper.ps1
Set-StrictMode -Version Latest #Class to register appropriate listeners based on environment class ListenerHelper { static ListenerHelper() { } static [void] RegisterListeners() { [WriteFolderPath]::GetInstance().RegisterEvents(); [WriteDetailedLog]::GetInstance().RegisterEvents(); ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/RemoteReports/RemoteReportHelper.ps1
RemoteReportHelper.ps1
Set-StrictMode -Version Latest class RemoteReportHelper { hidden static [string[]] $IgnoreScanParamList = "DoNotOpenOutputFolder"; hidden static [string[]] $AllowedServiceScanParamList = "SubscriptionId", "ResourceGroupNames"; hidden static [string[]] $AllowedSubscriptionScanParamList = "SubscriptionId"; hi...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/RemoteReports/VulnDataPublisher.ps1
VulnDataPublisher.ps1
Set-StrictMode -Version Latest class VulnDataPublisher: ListenerBase { hidden VulnDataPublisher() { } hidden static [VulnDataPublisher] $Instance = $null; static [VulnDataPublisher] GetInstance() { if ( $null -eq [VulnDataPublisher]::Instance ) { [VulnDataPublisher]:...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/RemoteReports/TelemetryStrings.ps1
TelemetryStrings.ps1
Set-StrictMode -Version Latest class TelemetryKeys { static [string] $SubscriptionId = "SubscriptionId"; static [string] $SubscriptionName = "SubscriptionName"; static [string] $FeatureGroup = "FeatureGroup"; static [string] $Feature = "Feature"; static [string] $ResourceName = "ResourceName";...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/RemoteReports/UsageTelemetry.ps1
UsageTelemetry.ps1
Set-StrictMode -Version Latest class UsageTelemetry: ListenerBase { [Microsoft.ApplicationInsights.TelemetryClient] $TelemetryClient; hidden UsageTelemetry() { $this.TelemetryClient = [Microsoft.ApplicationInsights.TelemetryClient]::new() $this.TelemetryClient.InstrumentationKey = [Constants]::UsageTe...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/RemoteReports/ControlTelemetry.ps1
ControlTelemetry.ps1
Set-StrictMode -Version Latest class ControlTelemetry: ListenerBase { [Microsoft.ApplicationInsights.TelemetryClient] $TelemetryClient; hidden ControlTelemetry() { $this.TelemetryClient = [Microsoft.ApplicationInsights.TelemetryClient]::new() } hidden static [ControlTelemetry] $Instance = $nu...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/UserReports/WriteDataFile.ps1
WriteDataFile.ps1
Set-StrictMode -Version Latest class WriteDataFile: FileOutputBase { hidden static [WriteDataFile] $Instance = $null; hidden [int] $JsonDepth = 10; static [WriteDataFile] GetInstance() { if ( $null -eq [WriteDataFile]::Instance) { [WriteDataFile]::Instance = [...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/UserReports/WriteFolderPath.ps1
WriteFolderPath.ps1
Set-StrictMode -Version Latest class WriteFolderPath: FileOutputBase { hidden static [WriteFolderPath] $Instance = $null; static [WriteFolderPath] GetInstance() { if ($null -eq [WriteFolderPath]::Instance) { [WriteFolderPath]::Instance = [WriteFolderPath]::new(); ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/UserReports/WriteDetailedLog.ps1
WriteDetailedLog.ps1
Set-StrictMode -Version Latest class WriteDetailedLog: FileOutputBase { hidden static [WriteDetailedLog] $Instance = $null; static [WriteDetailedLog] GetInstance() { if ( $null -eq [WriteDetailedLog]::Instance) { [WriteDetailedLog]::Instance = [WriteDetailedLog]::new();...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/UserReports/WritePsConsole.ps1
WritePsConsole.ps1
Set-StrictMode -Version Latest class WritePsConsole: FileOutputBase { hidden static [WritePsConsole] $Instance = $null; static [WritePsConsole] GetInstance() { if ($null -eq [WritePsConsole]::Instance) { [WritePsConsole]::Instance = [WritePsConsole]::new(); } ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/UserReports/WriteSummaryFile.ps1
WriteSummaryFile.ps1
Set-StrictMode -Version Latest class WriteSummaryFile: FileOutputBase { hidden static [WriteSummaryFile] $Instance = $null; static [WriteSummaryFile] GetInstance() { if ( $null -eq [WriteSummaryFile]::Instance) { [WriteSummaryFile]::Instance = [WriteSummaryFile]::n...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Listeners/OMS/OMSOutput.ps1
OMSOutput.ps1
Set-StrictMode -Version Latest class OMSOutput: ListenerBase { hidden static [OMSOutput] $Instance = $null; #Default source is kept as SDL / PowerShell. #This value must be set in respective environment i.e. CICD,CC [string] $OMSSource; OMSOutput() { } static [OMSOutput] GetInstan...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Abstracts/EventBase.ps1
EventBase.ps1
using namespace System.Management.Automation Set-StrictMode -Version Latest # Class for providing capability to fire events # Also includes support to fire AzSdkGenericEvent and holds InvocationContext class EventBase { [string] $RunIdentifier = "default"; [InvocationInfo] $InvocationContext; [stri...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Abstracts/SVTCommandBase.ps1
SVTCommandBase.ps1
using namespace System.Management.Automation Set-StrictMode -Version Latest # Base class for SVT classes being called from PS commands # Provides functionality to fire important events at command call class SVTCommandBase: CommandBase { [string[]] $ExcludeTags = @(); [string[]] $ControlIds = @(); [Attest...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Abstracts/CommandBase.ps1
CommandBase.ps1
using namespace System.Management.Automation Set-StrictMode -Version Latest # Base class for all classes being called from PS commands # Provides functionality to fire important events at command call class CommandBase: AzSdkRoot { [string[]] $FilterTags = @(); CommandBase([string] $subscriptionId, [Invocati...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Abstracts/SVTBase.ps1
SVTBase.ps1
Set-StrictMode -Version Latest class SVTBase: AzSdkRoot { hidden [string] $ResourceId = "" [ResourceContext] $ResourceContext = $null; hidden [SVTConfig] $SVTConfig hidden [PSObject] $ControlSettings #hidden [PSObject] $ControlStateIndexer = @() #hidden [ControlState[]] $ControlStates =@() #...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Abstracts/FileOutputBase.ps1
FileOutputBase.ps1
Set-StrictMode -Version Latest class FileOutputBase: ListenerBase { static [string] $ETCFolderPath = "Etc"; [string] $FilePath = ""; [string] $FolderPath = ""; [string] $BasePath = ""; FileOutputBase() { [Helpers]::AbstractClass($this, [FileOutputBase]); } ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Abstracts/ListenerBase.ps1
ListenerBase.ps1
Set-StrictMode -Version Latest class ListenerBase: EventBase { [array] $RegisteredEvents = @(); ListenerBase() { [Helpers]::AbstractClass($this, [ListenerBase]); } [void] SetRunIdentifier([AzSdkRootEventArgument] $arguments) { $data = $arguments.Messages | Se...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Abstracts/AzSdkRoot.ps1
AzSdkRoot.ps1
Set-StrictMode -Version Latest class AzSdkRoot: EventBase { [SubscriptionContext] $SubscriptionContext; AzSdkRoot([string] $subscriptionId) { [Helpers]::AbstractClass($this, [AzSdkRoot]); #Set up subscription $this.SubscriptionContext = [SubscriptionContext]@{...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/IdentityHelpers.ps1
IdentityHelpers.ps1
Set-StrictMode -Version Latest class IdentityHelpers { hidden static [bool] IsServiceAccount($ObjectId, $SignInName, $ObjectType, $GraphAccessToken) { $return = $null $header = "Bearer " + $GraphAccessToken $RMContext = Get-AzureRmContext -ErrorAction Ignore $headers = @{"Authorization"=$he...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/RoleAssignmentHelper.ps1
RoleAssignmentHelper.ps1
using namespace Microsoft.Azure.Commands.Resources.Models.Authorization Set-StrictMode -Version Latest class RoleAssignmentHelper { static [PSRoleAssignment[]] GetAzSDKRoleAssignmentByScope([string] $scope, [bool] $recurse, [bool] $includeClassicAdministrators) { [PSRoleAssignment[]] $roleAssignments = @(); ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/RemoteApiHelper.ps1
RemoteApiHelper.ps1
Set-StrictMode -Version Latest class RemoteApiHelper { # TODO: Move to config hidden static [string] $ApiBaseEndpoint = [ConfigurationManager]::GetAzSdkConfigData().AzSDKApiBaseURL; #https://localhost:44380/api hidden static [Newtonsoft.Json.JsonSerializerSettings] $SerializerSettings; static R...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/SVTMapping.ps1
SVTMapping.ps1
Set-StrictMode -Version Latest class SVTMapping { static [string] GetResourceTypeEnumItems() { return ([SVTMapping]::Mapping | Where-Object { -not [string]::IsNullOrEmpty($_.ResourceTypeName) } | ForEach-Object { "$($_.ResourceTypeName.Replace(' ', '')) `r`n" } | Sort-Object); } ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/ConfigurationHelper.ps1
ConfigurationHelper.ps1
Set-StrictMode -Version Latest # # ConfigurationHelper.ps1 # class ConfigurationHelper { hidden static [PSObject] LoadOfflineConfigFile([string] $fileName) { #Load file from AzSDK App folder $rootConfigPath = [Constants]::AzSdkAppFolderPath + "\" ; $extension = [System.IO.Path]::GetExtensi...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/Helpers.ps1
Helpers.ps1
using namespace Newtonsoft.Json Set-StrictMode -Version Latest class Helpers { static AbstractClass($obj, $classType) { $type = $obj.GetType() if ($type -eq $classType) { throw("Class '$type' must be inherited") } } static [string] SanitizeFolderName($folderPat...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/SecurityCenterHelper.ps1
SecurityCenterHelper.ps1
using namespace Microsoft.Azure.Commands.Resources.Models.Authorization Set-StrictMode -Version Latest class SecurityCenterHelper { static [string] $PoliciesApi = "policies"; static [string] $AlertsApi = "alerts"; static [string] $TasksApi = "tasks"; static [string] $SecurityStatusApi = "securityStatuses"; ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/Constants.ps1
Constants.ps1
Set-StrictMode -Version Latest class Constants { #All constant used across all modules Defined Here. static [string] $DoubleDashLine = "================================================================================" static [string] $HashLine = "###########################################...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/ActiveDirectoryHelper.ps1
ActiveDirectoryHelper.ps1
Set-StrictMode -Version Latest class ActiveDirectoryHelper { static [PSObject] GetADAppServicePrincipalByAppId($ApplicationId) { $TenantId = (Get-AzureRmContext -ErrorAction Stop).Tenant.TenantId $ApiVersion = "1.6" $GraphApiUrl = [WebRequestHelper]::GraphApiUri + $TenantId + "/servicePrincipals/{...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Helpers/WebRequestHelper.ps1
WebRequestHelper.ps1
Set-StrictMode -Version Latest class WebRequestHelper { hidden static [string] $AzureManagementUri = "https://management.azure.com/"; hidden static [string] $GraphApiUri = "https://graph.windows.net/"; hidden static [string] $ClassicManagementUri = "https://management.core.windows.net/"; static [Sys...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/AzSdkSettings.ps1
AzSdkSettings.ps1
# # AzSdkSettings.ps1 # Set-StrictMode -Version Latest class AzSdkSettings { [string] $OMSWorkspaceId; [string] $OMSSharedKey; [string] $OMSType; [string] $OMSSource; [bool] $EnableAADAuthForOnlinePolicyStore; [bool] $UseOnlinePolicyStore; [string] $OnlinePolicyStoreUrl; [string] $Us...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/AzSdkGenericEvent.ps1
AzSdkGenericEvent.ps1
Set-StrictMode -Version Latest class AzSdkGenericEvent { static [string] $CustomMessage = "AzSdk.Generic.CustomMessage"; #EventArgument: MessageData static [string] $Exception = "AzSdk.Generic.Exception"; #EventArgument: ErrorRecord } class MessageDataBase { [string] $Message = ""; [PSObject...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/AzSdkConfig.ps1
AzSdkConfig.ps1
Set-StrictMode -Version Latest class AzSdkConfig { [string] $MaintenanceMessage [Environment] $Environment [string] $AzSDKRGName [string] $AzSDKRepoURL [string] $AzSDKServerVersion [string[]] $SubscriptionMandatoryTags = @() [string] $ERvNetResourceGroupNames [string] $UpdateCompatibleCCVersion [...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/ControlState.ps1
ControlState.ps1
Set-StrictMode -Version Latest class ControlState { ControlState() { } ControlState([string]$ControlId, [string] $InternalId, [string] $ChildResourceName, [string] $ActualVerificationResult, [string]$Version) { $this.ControlId = $ControlId; $this.InternalId = $InternalId; $this.ChildResource...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/Enums.ps1
Enums.ps1
Set-StrictMode -Version Latest enum VerificationResult { Manual Passed RiskAck Verify Failed Error Disabled } enum AttestationStatus { None NotAnIssue NotFixed } enum AttestControls { None All AlreadyAttested NotAttested } enum MessageType { Critical E...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/AzSdkEvent.ps1
AzSdkEvent.ps1
Set-StrictMode -Version Latest class AzSdkRootEvent { static [string] $CustomMessage = "AzSdk.CustomMessage"; #EventArgument: AzSdkRootEventArgument static [string] $GenerateRunIdentifier = "AzSdk.GenerateRunIdentifier"; #Creates a timestamp and publish, Initialize listeners #EventArgument: AzSdkRootE...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/SubscriptionCore/ManagementCertificate.ps1
ManagementCertificate.ps1
Set-StrictMode -Version Latest class ManagementCertificate { [string] $CertThumbprint [string] $SubjectName [string] $Issuer [PSObject] $Created [PSObject] $ExpiryDate [string] $IsExpired [PSObject] $Difference [bool] $Whitelisted hidden static [ManagementCertificate[]] ListManagementCertifica...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/SubscriptionCore/AzureSecurityCenter.ps1
AzureSecurityCenter.ps1
Set-StrictMode -Version Latest class AzureSecurityCenter { [PSObject] $Policies [PSObject] $Alerts [PSObject] $Tasks hidden static [PSObject] GetASCPolicies([PSObject] $policyObjects) { $pols =@() if($null -ne $policyObjects -and ($policyObjects | Measure-Object).Count -gt 0) { ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/SVT/PSCloudService.ps1
PSCloudService.ps1
# # CloudService.ps1 # Set-StrictMode -Version Latest class PSCloudService { [PSObject] $Name [PSObject] $Configuration [PSObject] $DeploymentSlot [RoleInstance[]] $RoleInstances [Role[]] $Roles [PSObject] $VirtualIps [PSObject] $UpgradeType [PSObject] $UpgradeDomainCount [Extension[]] $Extensio...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/SVT/SVTResource.ps1
SVTResource.ps1
Set-StrictMode -Version Latest class ResourceTypeMapping { [string] $ResourceTypeName [string] $ResourceType [string] $JsonFileName [string] $ClassName } class SubscriptionMapping { [string] $JsonFileName [string] $ClassName } class SVTResource { [string] $ResourceId = "...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/SVT/SVTEvent.ps1
SVTEvent.ps1
Set-StrictMode -Version Latest class SVTEvent { #First level event #Command level event static [string] $CommandStarted = "AzSdk.SVT.Command.Started"; #Initialize listeners #Function execution started static [string] $CommandCompleted = "AzSdk.SVT.Command.Completed"; #Cleanup listeners #Fu...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/SVT/SVTConfig.ps1
SVTConfig.ps1
Set-StrictMode -Version Latest class SVTConfig { [string] $FeatureName = "" [string] $Reference = "" [bool] $IsManintenanceMode [ControlItem[]] $Controls = @(); hidden static [SVTConfig] LoadServerConfigFile([string] $fileName, [bool] $useOnlinePolicyStore, [string] $onlineStoreUri, [bool] $...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/RemoteReports/ScanResultModels.ps1
ScanResultModels.ps1
Set-StrictMode -Version Latest class ScanInfoBase { [ScanInfoVersion] $ScanInfoVersion; [string] $SubscriptionId; [string] $SubscriptionName; [ScanSource] $Source; [string] $ScannerVersion; [string] $ControlVersion; ScanInfoBase() { $this.ScanInfoVersion = [ScanInfoVersi...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/ContinuousCompliance/AutomationAccount.ps1
AutomationAccount.ps1
Set-StrictMode -Version Latest enum ScheduleFrequency { Hour Day } class AutomationAccount { hidden [string] $Name hidden [string] $ResourceGroup hidden [string] $Location hidden [string] $AzureADAppName hidden [Hashtable] $RGTags hidden [Hashtable] $AccountTags } class UserConfig { h...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/Framework/Models/SubscriptionSecurity/SubscriptionRBAC.ps1
SubscriptionRBAC.ps1
Set-StrictMode -Version Latest # Defines data structure for subscription RBAC json class SubscriptionRBAC { [ActiveRBACAccount[]] $ValidActiveAccounts = @(); [RBACAccount[]] $DeprecatedAccounts = @(); } class RBACAccount { #Fields from JSON [string] $Name = ""; [string] $Description = ""; ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/ContinuousCompliance/ContinuousCompliance.ps1
ContinuousCompliance.ps1
Set-StrictMode -Version Latest function Install-AzSDKContinuousAssurance { <# .SYNOPSIS This command would help in installing Automation Account in your subscription to setup Continous Assurance feature of AzSDK .DESCRIPTION This command will install an Automation Account (Name: AzSDKContinuousAssurance) ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/SubscriptionSecurity/ARMPolicy.ps1
ARMPolicy.ps1
Set-StrictMode -Version Latest function Set-AzSDKARMPolicies { <# .SYNOPSIS This command would help in setting up the AzSDK ARM Policies for a Subscription .DESCRIPTION This command would help in setting up the AzSDK ARM Policies for a Subscription .LINK https://aka.ms/azsdkdocs #> [CmdletB...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/SubscriptionSecurity/Alerts.ps1
Alerts.ps1
Set-StrictMode -Version Latest function Set-AzSDKAlerts { <# .SYNOPSIS This command would help in setting up the Alert rules for the all the critical actions across different Azure Resources under a given Subscription .DESCRIPTION This command can be used to setup alert rules for critical resource action...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/SubscriptionSecurity/SubscriptionSecurity.ps1
SubscriptionSecurity.ps1
Set-StrictMode -Version Latest function Set-AzSDKSubscriptionSecurity { <# .SYNOPSIS This command would help in setting up the all the critical subscription security packages .DESCRIPTION This command would help in setting up the all the critical subscription security packages .LINK https://aka...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/SubscriptionSecurity/RBAC.ps1
RBAC.ps1
Set-StrictMode -Version Latest function Set-AzSDKSubscriptionRBAC { <# .SYNOPSIS This command would help in setting up the RBAC rules for a given Subscription .DESCRIPTION This command would help in setting up the RBAC rules for a given Subscription .LINK https://aka.ms/azsdkdocs #> Param( ...
PowerShellCorpus/PowerShellGallery/AzSDKPreview/2.2.0/SubscriptionSecurity/SecurityCenter.ps1
SecurityCenter.ps1
Set-StrictMode -Version Latest function Set-AzSDKAzureSecurityCenterPolicies { <# .SYNOPSIS This command would help in setting up the Security Center policies for a Subscription .DESCRIPTION This command would help in setting up the Security Center policies for a Subscription .LINK https://aka.ms...
PowerShellCorpus/PowerShellGallery/PoshPrivilege/0.3.0.0/Scripts/Remove-Privilege.ps1
Remove-Privilege.ps1
Function Remove-Privilege { <# .SYNOPSIS Removes a specified privilege for a user or group .DESCRIPTION Removes a specified privilege for a user or group. This will remain until re-added using Add-Privilege or a policy is refreshed. .PARAMETER AccountNam...
PowerShellCorpus/PowerShellGallery/PoshPrivilege/0.3.0.0/Scripts/Add-Privilege.ps1
Add-Privilege.ps1
Function Add-Privilege { <# .SYNOPSIS Adds a specified privilege for a user or group .DESCRIPTION Adds a specified privilege for a user or group. This will remain until removed using Remove-Privilege or a policy is refreshed. .PARAMETER AccountName ...
PowerShellCorpus/PowerShellGallery/PoshPrivilege/0.3.0.0/Scripts/Enable-Privilege.ps1
Enable-Privilege.ps1
Function Enable-Privilege { <# .SYNOPSIS Enables specific privilege or privileges on the current process. .DESCRIPTION Enables specific privilege or privileges on the current process. .PARAMETER Privilege Specific privilege/s to enabl...
PowerShellCorpus/PowerShellGallery/PoshPrivilege/0.3.0.0/Scripts/Get-Privilege.ps1
Get-Privilege.ps1
Function Get-Privilege { <# .SYNOPSIS Gets all privileges on a local or remote system. .DESCRIPTION Gets the currently applied privileges or current user privileges. .PARAMETER Privilege Specific privilege/s to view. .PARAMET...
PowerShellCorpus/PowerShellGallery/PoshPrivilege/0.3.0.0/Scripts/Disable-Privilege.ps1
Disable-Privilege.ps1
Function Disable-Privilege { <# .SYNOPSIS Disables specific privilege or privileges on the current process. .DESCRIPTION Disables specific privilege or privileges on the current process. .PARAMETER Privilege Specific privilege/s to en...
PowerShellCorpus/PowerShellGallery/AzureRM.Sql/3.1.0/SqlStartup.ps1
SqlStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.Sql/3.1.0/ResourceManagerStartup.ps1
ResourceManagerStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.Sql/2.8.0/SqlStartup.ps1
SqlStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/AzureRM.Sql/2.8.0/ResourceManagerStartup.ps1
ResourceManagerStartup.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apach...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Misc/VHDResourceGenerator.ps1
VHDResourceGenerator.ps1
$name = New-DscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of the VHD File" $path = New-DscResourceProperty -Name Path -Type String -Attribute Key -Description "Folder where the VHD will be created" $parentPath = New-DscResourceProperty -Name ParentPath -Type String -Attribute Wri...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Misc/VMResourceGenerator.ps1
VMResourceGenerator.ps1
$name = New-xDscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of the VM" $vhdPath = New-xDscResourceProperty -Name VhdPath -Type String -Attribute Required -Description "VHD associated with the VM" $switchName = New-xDscResourceProperty -Name SwitchName -Type String -Attribute Write...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Misc/VMSwitchGenerator.ps1
VMSwitchGenerator.ps1
$name = New-DscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of the VM Switch" $type = New-DscResourceProperty -Name Type -Type String -Attribute Key -ValidateSet "Internal","Private" -Description "Type of switch" $netAdapter = New-DscResourceProperty -Name NetAdapterName -Type Stri...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMNetworkAdapter_MultipleVMMACAddress.ps1
Sample_xVMNetworkAdapter_MultipleVMMACAddress.ps1
Configuration VMAdapter { Import-DscResource -ModuleName xHyper-V -Name xVMNetworkAdapter Import-DscResource -ModuleName PSDesiredStateConfiguration xVMNetworkAdapter MyVM01NIC { Id = 'MyVM01-NIC' Name = 'MyVM01-NIC' SwitchName = 'SETSwitch' MacAddress = '001523be0c...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVhdFileExamples.ps1
Sample_xVhdFileExamples.ps1
# sample values used for testing. $vhdPath = "C:\test_vhds\RenameComputer.Vhd" # sample text file that you want to copy in the VHD. $sampletxt = "C:\sample.txt" # This path is the relative path to mounted drive letter. $sampleVhdDestinationPath = "xvhdFileExample\CopiedFile" # A local folder that you want ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVHD_AdditionalPropertyVHD.ps1
Sample_xVHD_AdditionalPropertyVHD.ps1
configuration Sample_xVHD_AdditionalPropertyVHD { param ( [Parameter(Mandatory)] [string]$Name, [Parameter(Mandatory)] [string]$Path, [Parameter(Mandatory)] [string]$ParentPath, [Parameter(Mandatory)] [string]$Maxim...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMNetworkAdapter_ManagementOS.ps1
Sample_xVMNetworkAdapter_ManagementOS.ps1
Configuration HostOSAdapter { Import-DscResource -ModuleName xHyper-V -Name xVMNetworkAdapter Import-DscResource -ModuleName PSDesiredStateConfiguration xVMNetworkAdapter HostOSAdapter { Id = 'Management-NIC' Name = 'Management-NIC' SwitchName = 'SETSwitch' VMName =...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMSwitch_Internal.ps1
Sample_xVMSwitch_Internal.ps1
configuration Sample_xVMSwitch_Internal { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$SwitchName ) Import-DscResource -module xHyper-V Node $NodeName { # Install HyperV feature, if not installed - Server SKU only ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMSwitch_External.ps1
Sample_xVMSwitch_External.ps1
configuration Sample_xVMSwitch_External { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$SwitchName, [Parameter(Mandatory)] [string]$NetAdapterName ) Import-DscResource -module xHyper-V Node $NodeN...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMNetworkAdapter_MultipleVM.ps1
Sample_xVMNetworkAdapter_MultipleVM.ps1
Configuration VMAdapter { Import-DscResource -ModuleName xHyper-V -Name xVMNetworkAdapter Import-DscResource -ModuleName PSDesiredStateConfiguration xVMNetworkAdapter MyVM01NIC { Id = 'MyVM01-NIC' Name = 'MyVM01-NIC' SwitchName = 'SETSwitch' VMName = 'MyVM01' ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMHyperV_DynamicMemory.ps1
Sample_xVMHyperV_DynamicMemory.ps1
configuration Sample_xVMHyperV_DynamicMemory { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$VMName, [Parameter(Mandatory)] [string]$VhdPath, [Parameter(Mandatory)] [Uint64]$StartupMemory, [Pa...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMNetworkAdapter_MultipleManagementOS.ps1
Sample_xVMNetworkAdapter_MultipleManagementOS.ps1
Configuration HostOSAdapter { Import-DscResource -ModuleName xHyper-V -Name xVMNetworkAdapter Import-DscResource -ModuleName PSDesiredStateConfiguration xVMNetworkAdapter ManagementAdapter { Id = 'Management-NIC' Name = 'Management-NIC' SwitchName = 'SETSwitch' VMNa...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMHyperV_Simple.ps1
Sample_xVMHyperV_Simple.ps1
configuration Sample_xVMHyperV_Simple { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$VMName, [Parameter(Mandatory)] [string]$VhdPath ) Import-DscResource -module xHyper-V Node $NodeName { ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVHD_DiffVHD.ps1
Sample_xVHD_DiffVHD.ps1
configuration Sample_xVhd_DiffVhd { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$Name, [Parameter(Mandatory)] [string]$Path, [Parameter(Mandatory)] [string]$ParentPath, ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVHD_MissingPropertyVHD.ps1
Sample_xVHD_MissingPropertyVHD.ps1
configuration Sample_xVHD_MissingPropertyVHD { param ( [Parameter(Mandatory)] [string]$Name, [Parameter(Mandatory)] [string]$Path, [ValidateSet("Vhd","Vhdx")] [string]$Generation = "Vhd", [ValidateSet("Present","Abse...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVHD_NewVHD.ps1
Sample_xVHD_NewVHD.ps1
configuration Sample_xVHD_NewVhd { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$Name, [Parameter(Mandatory)] [string]$Path, [Parameter(Mandatory)] [Uint64]$MaximumSizeBytes, ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMHyperV_Complete.ps1
Sample_xVMHyperV_Complete.ps1
configuration Sample_xVMHyperV_Complete { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$VMName, [Parameter(Mandatory)] [string]$VhdPath, [Parameter(Mandatory)] [Uint64]$StartupMemory, [Paramet...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Examples/Sample_xVMHyperV_SimpleWithDVDDrive.ps1
Sample_xVMHyperV_SimpleWithDVDDrive.ps1
configuration Sample_xVMHyperV_SimpleWithDvdDrive { param ( [string[]]$NodeName = 'localhost', [Parameter(Mandatory)] [string]$VMName, [Parameter(Mandatory)] [string]$VhdPath, [string]$ISOPath ) Import-DscResource -module xHyper-V ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Tests/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.Tests.ps1
MSFT_xVMNetworkAdapter.Tests.ps1
$Global:DSCModuleName = 'xHyper-V' $Global:DSCResourceName = 'MSFT_xVMNetworkAdapter' #region HEADER if ( (-not (Test-Path -Path '.\DSCResource.Tests\')) -or ` (-not (Test-Path -Path '.\DSCResource.Tests\TestHelper.psm1')) ) { & git @('clone','https://github.com/PowerShell/DscResource.Tests.git') } ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Tests/Unit/HyperVCommon.tests.ps1
HyperVCommon.tests.ps1
$script:DSCModuleName = 'xHyper-V' $script:DSCResourceName = 'HyperVCommon' #region HEADER # Unit Test Template Version: 1.1.0 [String] $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Tests/Unit/MSFT_xVMHyperV.Tests.ps1
MSFT_xVMHyperV.Tests.ps1
[CmdletBinding()] param() if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 { $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) } $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = '...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Tests/Unit/MSFT_xVMSwitch_BandwidthReservationMode.Tests.ps1
MSFT_xVMSwitch_BandwidthReservationMode.Tests.ps1
[CmdletBinding()] Param ( ) if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 { $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) } $ErrorActionPreference = 'Stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleNam...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Tests/Unit/MSFT_xVMDvdDrive.tests.ps1
MSFT_xVMDvdDrive.tests.ps1
$script:DSCModuleName = 'xHyper-V' $script:DSCResourceName = 'MSFT_xVMDvdDrive' #region HEADER # Unit Test Template Version: 1.1.0 [String] $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Te...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Tests/Integration/MSFT_xVMDvdDrive_remove.config.ps1
MSFT_xVMDvdDrive_remove.config.ps1
configuration MSFT_xVMDvdDrive_Remove_Config { Import-DscResource -ModuleName xHyper-V node localhost { xVMDvdDrive Integration_Test { VMName = $Node.VMName ControllerNumber = $Node.ControllerNumber ControllerLocation = $Node.ControllerLocation...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Tests/Integration/MSFT_xVMDvdDrive_add.config.ps1
MSFT_xVMDvdDrive_add.config.ps1
configuration MSFT_xVMDvdDrive_Add_Config { Import-DscResource -ModuleName xHyper-V node localhost { xVMDvdDrive Integration_Test { VMName = $Node.VMName ControllerNumber = $Node.ControllerNumber ControllerLocation = $Node.ControllerLocation ...
PowerShellCorpus/PowerShellGallery/xHyper-V/3.8.0.0/Tests/Integration/MSFT_xVMDvdDrive.Integration.Tests.ps1
MSFT_xVMDvdDrive.Integration.Tests.ps1
$script:DSCModuleName = 'xHyper-V' $script:DSCResourceName = 'MSFT_xVMDvdDrive' #region HEADER # Integration Test Template Version: 1.1.1 [String] $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCReso...
PowerShellCorpus/PowerShellGallery/cLocalFileShare/1.0.1/Examples/Sample_cLocalFileShare.ps1
Sample_cLocalFileShare.ps1
configuration Sample_cLocalFileShare { Import-DscResource -ModuleName PSDesiredStateConfiguration Import-DscResource -ModuleName cLocalFileShare File TestDirectory { Ensure = 'Present' DestinationPath = 'C:\TestDirectory' Type = 'Directory' } cLocalFileSha...
PowerShellCorpus/PowerShellGallery/cLocalFileShare/1.0.1/ResourceDesignerScripts/GenerateCLocalFileShareSchema.ps1
GenerateCLocalFileShareSchema.ps1
#requires -Version 4.0 -Modules xDSCResourceDesigner $ModuleName = 'cLocalFileShare' $ResourceName = 'cLocalFileShare' $DscResourceProperties = @( (New-xDscResourceProperty -Type String -Attribute Write -Name Ensure -ValidateSet 'Absent', 'Present' -Description 'Indicates if the share exists. Set this pr...
PowerShellCorpus/PowerShellGallery/cLocalFileShare/1.0.1/Tests/ResourceDesignerTests.ps1
ResourceDesignerTests.ps1
#requires -Version 4.0 -Modules xDSCResourceDesigner Split-Path -Path $PSScriptRoot -Parent | Join-Path -ChildPath 'DSCResources' | Get-ChildItem -Directory | Test-xDscResource -Name {$_.FullName} -Verbose
PowerShellCorpus/PowerShellGallery/PinnedItem/0.2.0.0/Scripts/Remove-PinnedItem.ps1
Remove-PinnedItem.ps1
Function Remove-PinnedItem { <# .SYNOPSIS Remove pinned items from StartMenu/Taskbar .DESCRIPTION Remove pinned items from StartMenu/Taskbar .PARAMETER InputObject Full path of pinned items that will be removed. Acceptable values: ...
PowerShellCorpus/PowerShellGallery/PinnedItem/0.2.0.0/Scripts/New-PinnedItem.ps1
New-PinnedItem.ps1
Function New-PinnedItem { <# .SYNOPSIS Adds a pinned item to the StartMenu/Taskbar .DESCRIPTION Adds a pinned item to the StartMenu/Taskbar .PARAMETER TargetPath Full path to the item that will be pinned .PARAMETER Type Determine whe...
PowerShellCorpus/PowerShellGallery/PinnedItem/0.2.0.0/Scripts/Get-PinnedItem.ps1
Get-PinnedItem.ps1
Function Get-PinnedItem { <# .SYNOPSIS Gets pinned items on StartMenu and/or Taskbar .DESCRIPTION Gets pinned items on StartMenu and/or Taskbar .PARAMETER Type Determine what types of pinned items will be returned. Acceptable values: ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Import-Rivet.ps1
Import-Rivet.ps1
<# .SYNOPSIS Imports the Rivet module. .DESCRIPTION When writing migrations, it can be helpful to get intellisense. In order to do so, you'll need to import Rivet. .EXAMPLE Import-Rivet.ps1 Demonstrates how to import the Rivet module. #> [CmdletBinding()] param( ) #Requires -Version 4 Set-StrictMo...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/rivet.ps1
rivet.ps1
<# .SYNOPSIS A database migration tool for PowerShell. .DESCRIPTION Rivet is a database migration tool for SQL Server. Finally! This script is the entry point for Rivet. It is used to create a new migration, and apply/revert migrations against a database. Called without any arguments, Rivet will shows thi...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Migrations/00000000000002_RivetIncreaseMigrationName.ps1
00000000000002_RivetIncreaseMigrationName.ps1
function Push-Migration { Update-Table -SchemaName 'rivet' -Name 'Migrations' -UpdateColumn { nvarchar 'Name' 241 -NotNull } Update-Table -SchemaName 'rivet' -Name 'Activity' -UpdateColumn { nvarchar 'Name' 241 -NotNull } Update-StoredProcedure -SchemaName 'rivet' -Name...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Migrations/00000000000003_RivetChangeStoredProcedureVarcharParametersToNVarchar.ps1
00000000000003_RivetChangeStoredProcedureVarcharParametersToNVarchar.ps1
function Push-Migration { Update-StoredProcedure -SchemaName 'rivet' -Name 'InsertMigration' -Definition @' @ID bigint, @Name nvarchar(241), @Who nvarchar(50), @ComputerName nvarchar(50) as begin declare @AtUtc datetime2(7) select @AtUtc = getutcdate() insert into [rivet].[Migrations] ([ID],[Nam...