full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/NetSecurity.ArgumentCompleters.ps1
NetSecurity.ArgumentCompleters.ps1
## NetSecurity module Custom Completers ## # # .SYNOPSIS # # Complete the -Name argument to *-NetConnectionProfile cmdlets # function NetFirewallRuleNameParameterCompleter { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) NetSecurity\Get-NetFirewallRule -Name "$wordTo...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/PowerShellDirect.ArgumentCompleters.ps1
PowerShellDirect.ArgumentCompleters.ps1
# Argument completer by Kurt Roggen [BE] - kurtroggen.be # PowerShell Direct (Windows 10/Windows Server 2016 HOST running Windows 10/Windows Server 2016 VM) # Supports cmdlets # - PSSession cmdlets ('Enter-PSSession','Get-PSSession','New-PSSession','Remove-PSSession','Invoke-Command') for -VMName and -VMId parameters #...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Microsoft.PowerShell.Diagnostics.ArgumentCompleters.ps1
Microsoft.PowerShell.Diagnostics.ArgumentCompleters.ps1
# # .SYNOPSIS # # Complete the -Counter argument to Get-Counter cmdlet # function CounterParameterCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $optionalCn = @{} $cn = $fakeBoundParameter["ComputerName"] if($cn) { $optionalCn.Compute...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/ISE.ArgumentCompleters.ps1
ISE.ArgumentCompleters.ps1
## ISE custom Completers ## # # .SYNOPSIS # # Complete the -Module argument to Import-IseSnippet # function IseSnippetModuleCompleter { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) Microsoft.PowerShell.Core\Get-Module -Name "$wordToComplete*" -ListAvailable | Sort-...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/DnsServer.ArgumentCompleters.ps1
DnsServer.ArgumentCompleters.ps1
# ARGUMENT COMPLETER FUNCTIONS ################################################# # DNS ZONE NAME function DNSServer_ZoneNameArgumentCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $optionalParams = @{} $CN = $fakeBoundParameter["ComputerName"] $CIMSe...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Pnpdevice.ArgumentCompleters.ps1
Pnpdevice.ArgumentCompleters.ps1
# ARGUMENT COMPLETER FUNCTIONS ################################################# # INSTANCE ID function PnpDevice_InstanceIdArgumentCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $optionalCimSession = @{} $CimSession = $fakeBoundParameter["CimSession"] ...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/NetQos.ArgumentCompleters.ps1
NetQos.ArgumentCompleters.ps1
# ARGUMENT COMPLETER FUNCTIONS ################################################# # NETQOS POLICY NAME function NetQoS_PolicyNameArgumentCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $optionalCim = @{} $cim = $fakeBoundParameter["CimSession"] if($ci...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Microsoft.PowerShell.LocalAccounts.ArgumentCompleters.ps1
Microsoft.PowerShell.LocalAccounts.ArgumentCompleters.ps1
# Argument completer by Kurt Roggen [BE] - kurtroggen.be - @roggenk # Microsoft.PowerShell.LocalAccounts module (Windows 10/Windows Server 2016) # Supports cmdlets # - *-LocalUser cmdlets (Parameters -SID) # - *-LocalGroup cmdlets (Parameters -Name, -SID, -Group) # - *-LocalGroupMember cmdlets (Parameters -Member) # A...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Wdac.ArgumentCompleters.ps1
Wdac.ArgumentCompleters.ps1
## Wdac module Custom Completers ## # # .SYNOPSIS # # Complete the -Name arguments to *-OdbcDriver cmdlets # function Wdac_OdbcDriverNameParameterCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) Wdac\Get-OdbcDriver -Name "$wordToComplete*" | Sort-Object Na...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/DFSR.ArgumentCompleters.ps1
DFSR.ArgumentCompleters.ps1
# ARGUMENT COMPLETER FUNCTIONS ################################################# # DFSR REPLICATION GROUP function DFSR_GroupNameArgumentCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) DFSR\Get-DfsReplicationGroup -GroupName "$wordToComplete*" | Sort...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Microsoft.PowerShell.Utility.ArgumentCompleters.ps1
Microsoft.PowerShell.Utility.ArgumentCompleters.ps1
# # Reading the registry for progids takes > 500ms, so we do it just once # function InitClassIdTable { $progIds = [Microsoft.Win32.Registry]::ClassesRoot.GetSubKeyNames() $versionedProgIds = new-object System.Collections.Generic.List[string] function AddProgId($progId) { $subKey = [Microsoft....
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/NetTCPIP.ArgumentCompleters.ps1
NetTCPIP.ArgumentCompleters.ps1
## NetTCPIP module Custom Completers ## # # .SYNOPSIS # # Complete the -InterfaceAlias arguments to NetTCPIP module cmdlets # function NetIPAddressInterfaceAliasParameterCompleter { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) NetTCPIP\Get-NetIPAddress -InterfaceAl...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/TabExpansionPlusPlus.ArgumentCompleters.ps1
TabExpansionPlusPlus.ArgumentCompleters.ps1
## TabExpansionPlusPlus custom Completers ## # # .SYNOPSIS # # Complete the -FilePath argument to Update-ArgumentCompleter # function UpdateArgumentFilePathCompleter { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) TabExpansionPlusPlus\Get-ArgumentCompleter | Where-Ob...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/WindowsExe.ArgumentCompleters.ps1
WindowsExe.ArgumentCompleters.ps1
# # .SYNOPSIS # # Complete parameters and arguments to PowerShell.exe # function PowerShellExeCompletion { param($wordToComplete, $commandAst) $tryParameters = $true $last = if ($wordToComplete) { -2 } else { -1 } $parameterAst = $commandAst.CommandElements[$last] -as [System.Management.Automation...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/NetLbfo.ArgumentCompleters.ps1
NetLbfo.ArgumentCompleters.ps1
# ARGUMENT COMPLETER FUNCTIONS ################################################# # NETLBFO TEAM MEMBERS function NetLBFO_TeamMembersArgumentCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $optionalCim = @{} $cim = $fakeBoundParameter["CimSession"] if...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/GroupPolicy.ArgumentCompleters.ps1
GroupPolicy.ArgumentCompleters.ps1
# ARGUMENT COMPLETER FUNCTIONS ################################################# # GPO function GroupPolicy_GPONameArgumentCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $optionalDomain = @{} $Domain = $fakeBoundParameter["Domain"] if($Domain) {...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Microsoft.PowerShell.Management.ArgumentCompleters.ps1
Microsoft.PowerShell.Management.ArgumentCompleters.ps1
# # .SYNOPSIS # # Complete the -Namespace argument to Wmi cmdlets (similiar to buil-in cim cmdlets namespace completion support) # function WmiNamespaceCompleter { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $nsParent='root' if ($wordToComplete) { [...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Dism.ArgumentCompleters.ps1
Dism.ArgumentCompleters.ps1
## Dism module Custom Completers ## # # .SYNOPSIS # # Complete the -FeatureName argument to DISM cmdlets # function Dism_WindowsOptionalFeatureNameCompleter { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) Dism\Get-WindowsOptionalFeature -Online | Where-Object Featur...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/BitsTransfer.ArgumentCompleters.ps1
BitsTransfer.ArgumentCompleters.ps1
# ARGUMENT COMPLETER FUNCTIONS ################################################# # BITS JOB NAME function BitsTransfer_JobNameArgumentCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) BitsTransfer\Get-BitsTransfer -Name "$wordToComplete*" | Sort-Object...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Microsoft.Azure.ArgumentCompleters.ps1
Microsoft.Azure.ArgumentCompleters.ps1
# # .SYNOPSIS # # Auto-complete the -StorageAccountName parameter value for Azure PowerShell cmdlets. # # .NOTES # # Created by Trevor Sullivan <pcgeek86@gmail.com> # http://trevorsullivan.net # function StorageAccount_StorageAccountNameCompleter { param($commandName, $parameterName, $wordToComplete, $...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/Microsoft.AzureRm.ArgumentCompleters.ps1
Microsoft.AzureRm.ArgumentCompleters.ps1
# # .SYNOPSIS # # Auto-complete the -Location parameter value for Azure PowerShell cmdlets. (version 1.0) # # .NOTES # # Created by Stuart Leeks # http://blogs.msdn.com/stuartleeks # http://twitter.com/stuartleeks # function AzureGeneral_LocationCompleter { param($commandName, $parameterName, $wordT...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/SmbShare.ArgumentCompleters.ps1
SmbShare.ArgumentCompleters.ps1
# # .SYNOPSIS # # Complete the -Name argument to *SmbShare cmdlets # function SmbShareNameParameterCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $optionalCimSession = @{} $cimSession = $fakeBoundParameter['CimSession'] if ($cimSession) { ...
PowerShellCorpus/PowerShellGallery/TabExpansionPlusPlus/1.2/DhcpServer.ArgumentCompleters.ps1
DhcpServer.ArgumentCompleters.ps1
# ARGUMENT COMPLETER FUNCTIONS ################################################# # DHCPSERVER function DhcpServer_ComputerNameArgumentCompletion { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) DhcpServer\Get-DhcpServerInDC | Where-Object {$_.DnsName -like "$wor...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.PowerShell/1.0.0.8/Confirm-YesOrNo.ps1
Confirm-YesOrNo.ps1
#Source: http://www.peetersonline.nl/2009/07/user-confirmation-in-powershell/ Function Confirm-YesOrNo { param( [string]$title="Confirm", [string]$message="Are you sure?" ) $choiceYes = New-Object System.Management.Automation.Host.ChoiceDescription '&Yes', 'Answer Yes.' $ch...
PowerShellCorpus/PowerShellGallery/PoshOpenShareFile/0.1.1.0/Scripts/Close-OpenFile.ps1
Close-OpenFile.ps1
Function Close-OpenFile { [cmdletbinding( SupportsShouldProcess = $True )] Param ( [parameter(ValueFromPipeline=$True)] [object]$InputObject ) Process { If ($PSCmdlet.ShouldProcess("$($_.Fullname) <$($_.UserName)>", 'Close File')) { $Return = [Po...
PowerShellCorpus/PowerShellGallery/PoshOpenShareFile/0.1.1.0/Scripts/Get-OpenFile.ps1
Get-OpenFile.ps1
Function Get-OpenFile { <# #> [OutputType('System.Io.File.OpenFile')] [cmdletbinding()] Param( [parameter(ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] [string[]]$Computername = $env:COMPUTERNAME, [parameter(ValueFromPipelineByPropertyName=$True)] ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Write-Log.ps1
Write-Log.ps1
function Write-Log { # write a message to the global log file [cmdletbinding()] param( [ValidateNotNullOrEmpty()] [string] $Message, [ValidateSet('Warning','Error','Verbose','Debug', 'Information')] [string] $Type = 'Information', [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Log ) ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Register-AutoCompleter.ps1
Register-AutoCompleter.ps1
function Register-AutoCompleter { function StorageType { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $ARM = ((invoke-webrequest -Uri $function:TemplateUrl -UseBasicParsing).Content)|ConvertFrom-Json $ARM.Parameters.StorageType.AvailableValues|?{$_ -like "...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Connect-O365.ps1
Connect-O365.ps1
function Connect-O365 { [cmdletbinding()] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [pscredential] $Credential ) try{ $i= 0 $session365 = $null while($session365 -eq $null -and ((get-command get-unifiedgroup -ErrorAction Ignore) -eq $null)){ $i++ write-log -message "Attempt...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/ConvertFrom-O365.ps1
ConvertFrom-O365.ps1
function ConvertFrom-O365 { [cmdletbinding()] [outputtype([psobject[]])] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [Array] $Users, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Path ) begin{ $CSVArray = @() } process { try{ foreach($User in $Users){ ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Get-0365License.ps1
Get-0365License.ps1
function Get-O365License { [cmdletbinding()] [OutputType([HashTable])] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$TenantId ) $Licenses = @{}; (Get-MsolAccountSku -TenantId $TenantId).foreach{ $License = New-Object License $License.Id = $_.AccountSkuId $License....
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Invoke-Operation.ps1
Invoke-Operation.ps1
function Invoke-Operation { [cmdletbinding()] param( [switch] $Wait, [scriptblock] $Code ={}, [hashtable] $Parameters, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [hashtable] $Syn...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Get-XAML.ps1
Get-XAML.ps1
function Get-XAML { [OutputType([hashtable])] [cmdletbinding()] $xaml = @{ GUI = @" <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/ble...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/ConvertTo-O365.ps1
ConvertTo-O365.ps1
function ConvertTo-O365{ [cmdletbinding()] param( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $Path, [Parameter()] [ValidateNotNullOrEmpty()] [string] $Separator = "`t", [Parameter(Mandatory=$true)] [hashtable] $Licenses ) try{ $Inventory = new-object -TypeName psobject -...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/New-SWRandomPassword.ps1
New-SWRandomPassword.ps1
function New-SWRandomPassword { <# .Synopsis Generates one or more complex passwords designed to fulfill the requirements for Active Directory .DESCRIPTION Generates one or more complex passwords designed to fulfill the requirements for Active Directory .EXAMPLE New-SWRandomPassword C&3SX6Kn Will ge...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Initialize-O365OneDrive.ps1
Initialize-O365OneDrive.ps1
None
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/New-CSPAdmin.ps1
New-CSPAdmin.ps1
function New-CSPAdmin { [CmdletBinding()] [OutputType([pscredential])] param( [Parameter()] [ValidateNotNullOrEmpty()] [string] $AccountName = "CSPAdmin", [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $DomainName ) try{ ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Set-ModuleVariable.ps1
Set-ModuleVariable.ps1
Function Set-ModuleVariable { [cmdletbinding()] param() $Config = Get-Content "$Root\config.json" | Out-String | ConvertFrom-Json foreach($Property in ($Config.config|gm -MemberType NoteProperty).Name){ $null = New-Variable -Scope Script -Name $Property -Value $($Config.config.$Property) -F...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Test-ModuleVersion.ps1
Test-ModuleVersion.ps1
function Test-ModuleVersion { [cmdletbinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $ModuleName ) try{ write-log -message "Checking if your $ModuleName module is up to date..." if($CurrentModule = (Get-Module -Name $Mod...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/New-O365Group.ps1
New-O365Group.ps1
function New-O365Group { param ( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string]$GroupName, [Parameter(Mandatory=$false)] [ValidateSet('office','security')] [string] $Type = 'security', ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Get-Tenant.ps1
Get-Tenant.ps1
function Get-Tenant { [cmdletbinding()] param( [Parameter()] [string] $TenantDomain, [Parameter()] [string] $TenantId, [Parameter()] [switch] $All ) begin { $Tenants = New-Object System.Collections.ArrayList $Tenant = $null ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Enable-O365ATP.ps1
Enable-O365ATP.ps1
Function Enable-O365ATP { [cmdletbinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $MailDomain ) begin{ $SafeLinkPolicyName = "$MailDomain Default SafeLink Policy" $SafeLinkRuleName = "$MailDomain Default SafeLink Rule" ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Register-Classes.ps1
Register-Classes.ps1
function Register-Classes { [CmdletBinding()] param() Add-Type -typedefinition @" using System; using System.Collections.Generic; using System.Linq; using System.Text; public enum TenantType { Office = 0, Azure = 1, All = 2 } public class License { ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Invoke-Message.ps1
Invoke-Message.ps1
function Invoke-Message { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $Message ) Write-Log -Message $Message $null = Add-Type -AssemblyName System.Windows.Fo...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/New-AzureAuomationServicePrincipal.ps1
New-AzureAuomationServicePrincipal.ps1
# work in progress function New-AzureAutomationServicePrincipal { $pass = "Abcd.1234567890" $cert = New-SelfSignedCertificate -CertStoreLocation "cert:\CurrentUser\My" -Subject "CN=FlexdeskBluePrint" -KeySpec KeyExchange $keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData()) $...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Start-Log.ps1
Start-Log.ps1
function Start-Log{ [OutputType([string])] [CmdletBinding()] param( [Parameter()] [ValidateNotNullOrEmpty()] [string] $LogName = "FlexdeskBlueprint_$(([guid]::newguid().guid)).log" ) # recreates the log file and sets the script parameter for use in the write-log function $_Log = "$env:APPDATA\Flexde...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Test-AADPasswordComplexity.ps1
Test-AADPasswordComplexity.ps1
Function Test-AADPasswordComplexity { [outputtype([string])] [cmdletbinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Password, [Parameter()] [ValidateNotNullOrEmpty()] [int]$MinimumLength = 8 ) begin{ ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/New-O365User.ps1
New-O365User.ps1
function New-O365User { param ( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string]$Username, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNul...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Get-Country.ps1
Get-Country.ps1
function Get-Country { [cmdletbinding()] param( ) $Hash = [ordered]@{ AD='Andorra' AE='United Arab Emirates' AF='Afghanistan' AG='Antigua and Barbuda' AI='Anguilla' AL='Albania' AM='Armenia' AO='Angola' AQ='An...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Add-O365UserToGroup.ps1
Add-O365UserToGroup.ps1
function Add-O365UserToGroup { param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string]$Username, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string]$groupname, [ValidateSet('office','security')] [string] $Type =...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Get-AzureRMResourceLocation.ps1
Get-AzureRMResourceLocation.ps1
function Get-AzureRMResourceLocation { [cmdletbinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $Location, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $Resource ) begin{ $RegionMap ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Get-O365OneDrive.ps1
Get-O365OneDrive.ps1
function Get-O365OneDrive { [CmdletBinding()] param( [Parameter()] [ValidateNotNullOrEmpty()] [pscredential] $Credential = (Get-Credential -Message "Enter your Tenant Account credentials"), [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/private/Test-AzureResourceLocation.ps1
Test-AzureResourceLocation.ps1
function Test-AzureResourceLocation { [OutputType([System.Collections.ArrayList])] [CmdletBinding(DefaultParameterSetName="Type")] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $Location, [Parameter(Mandatory=$true,ParameterSetName="Type")] ...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/public/New-FlexdeskAzureVpnCerts.ps1
New-FlexdeskAzureVpnCerts.ps1
<# #> function New-FlexdeskAzureVpnCerts { [cmdletbinding(DefaultParameterSetName="AzureTenantDomain")] param( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $ResourceGroupName, [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $GatewayName, [paramete...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/public/New-FlexdeskAzureDeployment.ps1
New-FlexdeskAzureDeployment.ps1
function New-FlexdeskAzureDeployment { [cmdletbinding(DefaultParameterSetName="AzureTenantDomain")] param( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $Location, [parameter()] [ValidateNotNullOrEmpty()] [ValidateSet('southeastasia','westeurope','northeurope','australiasout...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/public/New-FlexdeskOfficeDeployment.ps1
New-FlexdeskOfficeDeployment.ps1
function New-FlexdeskOfficeDeployment { [cmdletbinding(DefaultParameterSetName="TenantId")] [OutputType([psobject])] param( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] # The location of the input CSV file. [String] $CSV, [parameter(ParameterSetName="TenantId",Mandatory=$true)] [ValidateN...
PowerShellCorpus/PowerShellGallery/FlexdeskBlueprint/8.0.0.3/functions/public/Start-FlexdeskDeploymentGUI.ps1
Start-FlexdeskDeploymentGUI.ps1
Function Start-FlexdeskDeploymentGUI { [CmdletBinding()] param( [Parameter()] [switch] $NoUpdateCheck ) $Log = Start-Log $PSDefaultParameterValues = @{"Write-Log:Log"="$Log"} if(!$PSBoundParameters.ContainsKey('NoUpdateCheck')){ Test-ModuleVersion -ModuleName FlexdeskBluePrint } $script:Syn...
PowerShellCorpus/PowerShellGallery/xRegistryAccess/1.0.0.1/DSCResources/xRegistryAccess/test.ps1
test.ps1
Import-Module "D:\powershell script\VSps\TFS WorkSpace\xRegistryDscResource\xRegistryAccess\xRegistryAccess\bin\Debug\xRegistryAccess.dll" -Verbose -Force -Prefix X $par=@{ Account="WIN-SHASLLBSN4O\Lynn"; Path = "software\hphsite"; RegistryRights = "ReadKey"; ...
PowerShellCorpus/PowerShellGallery/xRegistryAccess/1.0.0.1/DSCResources/xRegistryAccess/Build.ps1
Build.ps1
New-xDscResource -Name xRegistryAccess -Property ` @( (New-xDscResourceProperty -Name Ensure -Type String -Attribute Key -ValidateSet "Absent","Present" ), (New-xDscResourceProperty -Name Path -Type String -Attribute Required ) (New-xDscResourceProperty -Name Account -Type String -Attribute Required ), ...
PowerShellCorpus/PowerShellGallery/publishmap/1.6.1.145/imports.ps1
imports.ps1
# grab functions from files get-childitem $psscriptroot\functions\ -filter "*.ps1" | ? { -not ($_.name.Contains(".Tests.")) } | ? { -not (($_.name).StartsWith("_")) } | % { . $_.fullname } $usenative = $true $lib = "$psscriptroot\lib\publishmap.core.dll" function loadLib($lib, [scriptblock] $init) { ...
PowerShellCorpus/PowerShellGallery/publishmap/1.6.1.145/functions/inheritance.ps1
inheritance.ps1
<# .PARAMETER valuesOnly Inherit only value types, do not inherit dictionaries (helps prevent infinite inheritance loop) #> function Add-InheritedProperties($from, $to, $exclude = @(), [switch][bool] $valuesOnly) { # Measure-function "$($MyInvocation.MyCommand.Name)" { if ($from -is [System.Collections.I...
PowerShellCorpus/PowerShellGallery/publishmap/1.6.1.145/functions/perfcounters.ps1
perfcounters.ps1
$script:perfstack = @() $fullperfnames = $false function measure-function([string] $__name, [scriptblock] $__command) { $__result = $null $__cmd = { $__result = Invoke-Command $__command } if ($script:perfstack -eq $null) { $script:perfstack = @() } $__isrecursion = $__nam...
PowerShellCorpus/PowerShellGallery/publishmap/1.6.1.145/functions/object-properties.ps1
object-properties.ps1
function get-propertynames($obj) { # Measure-function "$($MyInvocation.MyCommand.Name)" { if ($obj -is [System.Collections.IDictionary]) { return $obj.keys } return $obj.psobject.Properties | select -ExpandProperty name # } } function add-properties( [Parameter(Mandat...
PowerShellCorpus/PowerShellGallery/publishmap/1.6.1.145/functions/Match-Vars.ps1
Match-Vars.ps1
<# .PARAMETER simpleMode for better performance. do not perform variable substitution based on self and root should still work for simpler scenarios #> function _clone($obj, [switch][bool] $deep, [int]$level = 0, [int]$maxdepth = 10, $shallowkeys = @()) { try { # Measure-function "$($MyIn...
PowerShellCorpus/PowerShellGallery/publishmap/1.6.1.145/functions/process-map.ps1
process-map.ps1
function import-map { [cmdletbinding()] param([Parameter(Mandatory=$true)] $maps) if ($maps -is [System.Collections.IDictionary] ) { return import-mapobject $maps } else { return import-mapfile $maps } } function import-mapfile { [cmdletbinding()] param([Paramet...
PowerShellCorpus/PowerShellGallery/publishmap/1.6.1.145/functions/objectcache.ps1
objectcache.ps1
function set-cachedobject($triggerfile, $object) { if (!(test-path $triggerfile)) { throw "trigger file '$triggerfile' not found" } $f = gi $triggerfile $ts = $f.LastWriteTimeUtc $global:cache[$triggerfile] = @{ ts = $ts value = $object file = (gi $triggerfile).FullName } } ...
PowerShellCorpus/PowerShellGallery/publishmap/1.6.1.145/functions/process-publishmap.ps1
process-publishmap.ps1
if ($null -eq $global:cache) { $global:cache = @{} } function import-publishmap { [cmdletbinding()] param([Parameter(Mandatory=$false)] $maps = $null, [alias("nocache")][switch][bool]$force) if ($force) { $global:cache = @{} } if ($maps -is [System.Collections.IDictionary] ) { ...
PowerShellCorpus/PowerShellGallery/Fmg-SqlDb/0.1.0/Read-DbData.ps1
Read-DbData.ps1
function Read-DbData() { <# .SYNOPSIS Reads data from a SQL query .DESCRIPTION Creates a cmd object, sets the query and parameters, and invokes ExecuteReader on the command. This cmdlet only supports single result sets like selecting one or more rows from a table. .PARAMETER Co...
PowerShellCorpus/PowerShellGallery/Fmg-SqlDb/0.1.0/Write-DbData.ps1
Write-DbData.ps1
function Write-DbData() { <# .SYNOPSIS Writes data to a sql store. .DESCRIPTION Creates a single command that is used multiple times with different parameter sets to insert or update data into a sql store. .PARAMETER ConnectionString (Optional) The connection string is used to...
PowerShellCorpus/PowerShellGallery/Fmg-SqlDb/0.1.0/Set-DbConnectionString.ps1
Set-DbConnectionString.ps1
$fmgConnectionString = $null; $fmgParameterPrefix = "@"; [System.Data.Common.DbProviderFactory] $fmgDbFactory = $null; function Get-DbConnectionString() { <# .SYNOPSIS Gets the default global connection string .DESCRIPTION This function is called in absense of a specified connection string...
PowerShellCorpus/PowerShellGallery/Fmg-SqlDb/0.1.0/New-DbCommand.ps1
New-DbCommand.ps1
function New-DbCommand() { <# .SYNOPSIS Creates a new SQL command object .DESCRIPTION Creates a new SQL command, sets the command type to text by default, requires the SQL statement, and allows users to specify parameters. If the `Do` parameter is not specified, the cmd object is r...
PowerShellCorpus/PowerShellGallery/Fmg-SqlDb/0.1.0/New-DbConnection.ps1
New-DbConnection.ps1
function New-DbConnection() { <# .SYNOPSIS Creates a new sql connection object .DESCRIPTION This cmdlet is called in absense of a specified connection string for cmdlet that require them. .PARAMETER ConnectionString (Optional) If the `Do` parameter is specified, a connection s...
PowerShellCorpus/PowerShellGallery/Fmg-SqlDb/0.1.0/Invoke-DbCmd.ps1
Invoke-DbCmd.ps1
function Invoke-DbCmd() { <# .SYNOPSIS Creates and invokes a new sql command using ExecuteNonQuery .DESCRIPTION Creates and invokes a new sql command using ExecuteNonQuery .PARAMETER ConnectionString (Optional) The connection string is used to create and open the connection. .P...
PowerShellCorpus/PowerShellGallery/Fmg-SqlDb/0.1.0/Add-DbParameters.ps1
Add-DbParameters.ps1
function Add-DbParameters() { Param( [Parameter(Mandatory = $true, Position = 1, ValueFromPipeline = $true)] [System.Data.IDbCommand] $Command, [Parameter(Position = 2)] [Object] $Parameters, [Parameter(Position = 3)] [String] $ParameterPrefix, [switch...
PowerShellCorpus/PowerShellGallery/Fmg-SqlDb/0.1.0/New-SqlClientParameter.ps1
New-SqlClientParameter.ps1
function New-SqlClientParameter() { <# .SYNOPSIS Creates a new System.Data.SqlClient.SqlParameter object. .DESCRIPTION By default, the .NET framework has an implementation for SqlClient and thus this cmdlet exists to help create new SqlParameter objects. .PARAMETER ParameterName ...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/private/ASTFunctions.ps1
ASTFunctions.ps1
Function Get-ASTFromInput { [CmdletBinding()] param( [Parameter(Mandatory)]$Content ) $ast = [System.Management.Automation.Language.Parser]::ParseInput($Content,[ref]$null,[ref]$Null) return $ast } Function Get-TestNameAndTestBlock { [OutputType([String])] param( [Parameter()] [String]$Content ) $ast ...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/private/RemoteSession.ps1
RemoteSession.ps1
function CopyStreams { param ( [Parameter(Position=0, Mandatory=$true)] $inputStream ) $outStream = New-Object 'System.Management.Automation.PSDataCollection[PSObject]' foreach($item in $inputStream) { $outStream.Add($item) } $outStream.Complete() ,$outS...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/private/bootstrap.ps1
bootstrap.ps1
Function UpdateRemotelyNodeMap { [CmdletBinding()] param( [Parameter(Mandatory)] [HashTable]$ModuleStatus, [Parameter(Mandatory)] [bool]$PathStatus, [Parameter(Mandatory)] [String]$NodeName ) $nodeName = $NodeName.Replace('[','') $nodeName = $nodeNam...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/private/Helper.ps1
Helper.ps1
Function ProcessRemotelyJob { [CmdletBinding()] param( [Parameter(Mandatory, ValueFromPipeline)] [System.Collections.DictionaryEntry]$InputObject ) $NodeName = $InputObject.Key $Job = $InputObject.Value foreach($childJob in $Job.ChildJobs){ if($childJob.Output.Count -eq...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/private/ConfigurationData.ps1
ConfigurationData.ps1
# TO DO - Rename the below to Assert-ConfigData Function Test-ConfigData { [CmdletBinding()] param( [Parameter(Mandatory)] [HashTable]$ConfigurationData ) # Configuration Data should contain 'AllNodes' key if ( -not $ConfigurationData.ContainsKey('AllNodes')) { Throw 'ConfigurationData parameter need to ha...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Pester.Tests.ps1
Pester.Tests.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $manifestPath = "$here\Pester.psd1" $changeLogPath = "$here\CHANGELOG.md" # DO NOT CHANGE THIS TAG NAME; IT AFFECTS THE CI BUILD. Describe -Tags 'VersionChecks' "Pester manifest and changelog" { $script:manifest = $null It "has a valid manifest" { ...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/It.Tests.ps1
It.Tests.ps1
Set-StrictMode -Version Latest InModuleScope Pester { Describe 'Get-PesterResult' { } Describe 'It - Implementation' { $testState = New-PesterState -Path $TestDrive It 'Throws an error if It is called outside of Describe' { $scriptBlock = { ItImpl -Pester $testState 'Tries to ...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/TestsRunningInCleanRunspace.Tests.ps1
TestsRunningInCleanRunspace.Tests.ps1
function Invoke-PesterInJob ($ScriptBlock) { #TODO: there must be a safer way to determine this while I am in describe $PesterPath = Get-Module -Name Pester | Select -First 1 -ExpandProperty Path $job = Start-Job { param ($PesterPath, $TestDrive, $ScriptBlock) Import-Module $PesterPath -For...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/TestDrive.ps1
TestDrive.ps1
# function New-TestDrive ([Switch]$PassThru) { $Path = New-RandomTempDirectory $DriveName = "TestDrive" if (-not (& $SafeCommands['Test-Path'] -Path $Path)) { & $SafeCommands['New-Item'] -ItemType Container -Path $Path | & $SafeCommands['Out-Null'] } #setup the test drive if ( -not...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/BreakAndContinue.Tests.ps1
BreakAndContinue.Tests.ps1
Describe 'Clean handling of break and continue' { # If this test 'fails', it'll just cause most of the rest of the tests to never execute (and we won't see any actual failures.) # The CI job monitors metrics, though, and will fail the build if the number of tests drops too much. Context 'Break' { b...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/New-Fixture.ps1
New-Fixture.ps1
function New-Fixture { <# .SYNOPSIS This function generates two scripts, one that defines a function and another one that contains its tests. .DESCRIPTION This function generates two scripts, one that defines a function and another one that contains its tests. The files are by default p...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/TestResults.ps1
TestResults.ps1
function Get-HumanTime($Seconds) { if($Seconds -gt 0.99) { $time = [math]::Round($Seconds, 2) $unit = 's' } else { $time = [math]::Floor($Seconds * 1000) $unit = 'ms' } return "$time$unit" } function GetFullPath ([string]$Path) { if (-not [System.IO.Path]::IsPath...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/TestDrive.Tests.ps1
TestDrive.Tests.ps1
Set-StrictMode -Version Latest $tempPath = (Get-Item $env:temp).FullName Describe "Setup" { It "returns a location that is in a temp area" { $testDrivePath = (Get-Item $TestDrive).FullName $testDrivePath -like "$tempPath*" | Should Be $true } It "creates a drive location called TestDrive:...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/InModuleScope.Tests.ps1
InModuleScope.Tests.ps1
Set-StrictMode -Version Latest Describe "Module scope separation" { Context "When users define variables with the same name as Pester parameters" { $test = "This is a test." It "does not hide user variables" { $test | Should Be 'This is a test.' } } It "Does not expose...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/In.Tests.ps1
In.Tests.ps1
Set-StrictMode -Version Latest InModuleScope Pester { Describe "the In statement" { Setup -Dir "test_path" It "executes a command in that directory" { In "$TestDrive" -Execute { "" | Out-File "test_file" } "$TestDrive\test_file" | Should Exist } It "updates...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/SetupTeardown.ps1
SetupTeardown.ps1
function BeforeEach { <# .SYNOPSIS Defines a series of steps to perform at the beginning of every It block within the current Context or Describe block. .DESCRIPTION BeforeEach, AfterEach, BeforeAll, and AfterAll are unique in that they apply to the entire Context or Describe block, regardless of the o...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/GlobalMock-B.Tests.ps1
GlobalMock-B.Tests.ps1
# This test depends on some state set up in GlobalMock-A.Tests.ps1. The behavior we're verifying # is that global functions that have been mocked are still properly set up even after the test # script exits its scope. $functionName = '01c1a57716fe4005ac1a7bf216f38ad0' try { Describe 'Mocking Global Functions - P...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/Coverage.ps1
Coverage.ps1
if ($PSVersionTable.PSVersion.Major -le 2) { function Exit-CoverageAnalysis { } function Get-CoverageReport { } function Show-CoverageReport { } function Enter-CoverageAnalysis { param ( $CodeCoverage ) if ($CodeCoverage) { & $SafeCommands['Write-Error'] 'Code coverage analysis requires...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/New-Fixture.Tests.ps1
New-Fixture.Tests.ps1
Set-StrictMode -Version Latest Describe "New-Fixture" { It "Name parameter is mandatory:" { (get-command New-Fixture ).Parameters.Name.ParameterSets.__AllParameterSets.IsMandatory | Should Be $true } Context "Only Name parameter is specified:" { It "Creates fixture in current directory:" {...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/Describe.Tests.ps1
Describe.Tests.ps1
Set-StrictMode -Version Latest Describe 'Testing Describe' { It 'Has a non-mandatory fixture parameter which throws the proper error message if missing' { $command = Get-Command Describe -Module Pester $command | Should Not Be $null $parameter = $command.Parameters['Fixture'] $para...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/Context.Tests.ps1
Context.Tests.ps1
Set-StrictMode -Version Latest Describe 'Testing Context' { It 'Has a non-mandatory fixture parameter which throws the proper error message if missing' { $command = Get-Command Context -Module Pester $command | Should Not Be $null $parameter = $command.Parameters['Fixture'] $parame...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/TestResults.Tests.ps1
TestResults.Tests.ps1
Set-StrictMode -Version Latest InModuleScope Pester { Describe "Write nunit test results (Legacy)" { Setup -Dir "Results" It "should write a successful test result" { #create state $TestResults = New-PesterState -Path TestDrive:\ $testResults.EnterDescribe('Mock...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/PesterState.ps1
PesterState.ps1
function New-PesterState { param ( [String[]]$TagFilter, [String[]]$ExcludeTagFilter, [String[]]$TestNameFilter, [System.Management.Automation.SessionState]$SessionState, [Switch]$Strict, [Switch]$Quiet ) if ($null -eq $SessionState) { $SessionState = $Execut...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/PesterState.Tests.ps1
PesterState.Tests.ps1
Set-StrictMode -Version Latest InModuleScope Pester { Describe "New-PesterState" { Context "TestNameFilter parameter is set" { $p = new-pesterstate -TestNameFilter "filter" it "sets the TestNameFilter property" { $p.TestNameFilter | should be "filter" ...
PowerShellCorpus/PowerShellGallery/PSRemotely/1.0.4/lib/Pester/3.3.14/Functions/Context.ps1
Context.ps1
function Context { <# .SYNOPSIS Provides logical grouping of It blocks within a single Describe block. Any Mocks defined inside a Context are removed at the end of the Context scope, as are any files or folders added to the TestDrive during the Context block's execution. Any BeforeEach or AfterEach blocks defined insid...