filename stringlengths 5 142 | content stringlengths 2 26M | label int64 0 1 |
|---|---|---|
1607.ps1 |
$a1 = New-Object System.Collections.ArrayList
$a2 = New-Object System.Collections.ArrayList
$a3 = New-Object System.Collections.ArrayList
$a4 = New-Object System.Collections.ArrayList
$a5 = New-Object System.Collections.ArrayList
$a6 = New-Object System.Collections.ArrayList
$a7 = New-Object System.Collections.Arr... | 0 |
4403.ps1 | function New-FastPackageReference
{
param
(
[Parameter(Mandatory=$true)]
[string]
$ProviderName,
[Parameter(Mandatory=$true)]
[string]
$PackageName,
[Parameter(Mandatory=$true)]
[string]
$Version,
[Parameter(Mandatory=$true)]
... | 0 |
sample_6_27.ps1 | if($OSVersion.Major -ge 6)
{
$EventLogNames ="Microsoft-Windows-TaskScheduler/Operational",
"Microsoft-Windows-TaskScheduler/Debug",
"Microsoft-Windows-TaskScheduler/Diagnostic",
"Microsoft-Windows-TaskScheduler/Maintenance"
$OutputFormats = "TXT", "CSV", "EVTX"
.\TS_GetEvents.ps1 -EventLogName... | 0 |
sample_0_68.ps1 | # <copyright>
# INTEL CONFIDENTIAL
#
# Copyright 2021 Intel Corporation
#
# This software and the related documents are Intel copyrighted materials, and your use of
# them is governed by the express license under which they were provided to you ("License").
# Unless the License provides otherwise, you may not us... | 0 |
The PowerShell Talk 2.ps1 | #The PowerShell Talk
#Demo 2 - VM Easy Bake Oven
#VMware
#Connect to vCenter
Get-Credential | connect-viserver -Server "Your vCenter Here"
#Create the new VM
get-vmhost -Name "ESX Server" | New-VM -Name Dave -DiskMB "10240" -GuestId "otherGuest" -MemoryMB 512 -NumCpu 1 -resourcepool "Demo"
#Get some info ... | 0 |
sample_36_11.ps1 | #
# Module manifest for module 'OCI.PSModules.Waa'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Waa.dll'
# Version number of this module.
ModuleVersion = '77.0.0'
# Supported PSEditions
CompatiblePSEd... | 0 |
sample_0_33.ps1 | Import-LocalizedData -BindingVariable WMIStrings -FileName DC_WMISecurityCenter -UICulture en-us
Write-DiagProgress -Activity $WMIStrings.ID_SecurityCenter -Status $WMIStrings.ID_SecurityCenterDesc
$OutputFile = $ComputerName + "_SecurityCenter.txt"
$file = new-item -type file $OutputFile | Out-Null #_#
# Compu... | 0 |
sample_28_36.ps1 | ConvertFrom-StringData @'
###PSLOC
CheckNICConnectivity = Find out which NICs are able to connect on each node.
NoPingableConnections = Server '{0:ServerName}' does not have any pingable connections. Could be caused by the failed network configuration step or, less likely, a hardware failure.
NetworkingAlreadyConfi... | 0 |
sample_14_29.ps1 | #
# Module manifest for module 'OCI.PSModules.Cims'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Cims.dll'
# Version number of this module.
ModuleVersion = '81.0.0'
# Supported PSEditions
CompatiblePS... | 0 |
4074.ps1 |
[CmdletBinding()]
param
(
[switch]$SystemInstall,
[ValidateNotNullOrEmpty()][string]$InstallLocation = 'C:\windows\system32',
[switch]$UserConfig,
[ValidateNotNullOrEmpty()][string]$PSConsoleTitle = 'CMTrace Installation'
)
function Close-Process {
[CmdletBinding()]
param
(
[ValidateNotNullOrEmpty()]... | 0 |
New-ArgsTestExe.ps1 | Add-Type -Type @"
using System;
internal class ArgsTest
{
private static void Main(string[] args)
{
Console.WriteLine();
/*
I've commented this out because (at least in C#)
it is the same as Environment.GetCommandLineArgs()
Except that GetCommandLineArgs shows p... | 0 |
2882.ps1 | task default -depends Test
task Test -depends Compile, Clean -PreAction {"Pre-Test"} -Action {
"Test"
} -PostAction {"Post-Test"}
task Compile -depends Clean {
"Compile"
}
task Clean {
"Clean"
}
| 0 |
149.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_65_40.ps1 | <#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.194
Created on: 10/19/2021 3:50 PM
Created by: ksarens
Updated 10/26/2102
fixing error in help information
adding support for offline... | 0 |
sample_22_45.ps1 | #
# Module manifest for module 'OCI.PSModules.Operatoraccesscontrol'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Operatoraccesscontrol.dll'
# Version number of this module.
ModuleVersion = '77.0.0'
#... | 0 |
sample_25_65.ps1 | ##############################################################################
# PREVIEW VERSION OF PSAKE SCRIPT FOR MODULE BUILD & PUBLISH TO THE PSGALLERY
##############################################################################
#
# We are hoping to add support for publishing modules to the PowerShell galler... | 0 |
sample_31_53.ps1 | <#
.Synopsis
Activate a Python virtual environment for the current PowerShell session.
.Description
Pushes the python executable for a virtual environment to the front of the
$Env:PATH environment variable and sets the prompt to signify that you are
in a Python virtual environment. Makes use of the command line... | 0 |
sample_0_12.ps1 | #
#
# Rule to look for organizations that are newer than the deployment
#
# Created: 5/24/2012
# Author: Jonathan Randall
#******************************************************************************************************************
#region Functions
function GetOrganizationData([string] $conn_string)
... | 0 |
sample_9_31.ps1 | #************************************************
# DC_AppxCollect.ps1
# Version 1.1
# Date: 2009-2019
# Author: Walter Eder (waltere@microsoft.com)
# Description: Collects AppX additional information.
# Called from: TS_AutoAddCommands_Apps.ps1
#*******************************************************
Trap [Ex... | 0 |
sample_27_67.ps1 | <###################################################
# #
# Copyright (c) Microsoft. All rights reserved. #
# #
##################################################>
function Get-WinRMComputerName
{
<#
.... | 0 |
Test-FileLock_1.ps1 | #####################################################################
# Test-FileLock.ps1
# Version 1.0
#
# test if file is locked by external program or not
#
# Vadims Podans (c) 2009
# http://www.sysadmins.lv/
#####################################################################
filter Test-FileLock {
... | 0 |
Get-ExcludedCsprojJavasc_1.ps1 | param(
$projectDirectoryName = "MyProject"
)
$thisDir = Split-Path $MyInvocation.MyCommand.Path
$projectDir = "$thisDir/../$projectDirectoryName"
$csproj = [xml](cat $projectDir/*.csproj)
$csprojScripts = $csproj.Project.ItemGroup.Content.Include | ? {$_ -match '\\.js$'}
"$($csprojScripts.length) scrip... | 0 |
sample_29_87.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 |
32.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 ($Aa... | 0 |
1989.ps1 |
Describe "CimInstance cmdlet tests" -Tag @("CI") {
BeforeAll {
if ( ! $IsWindows ) { return }
$instance = Get-CimInstance CIM_ComputerSystem
}
It "CimClass property should not be null" -Pending:(-not $IsWindows) {
$instance.CimClass.CimClassName | Shoul... | 0 |
734.ps1 |
function Export-RsSubscriptionXml {
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')]
param(
[Parameter(Mandatory=$True,Position=0)]
[string]
$Path,
[Parameter(Mandatory = $True, ValueFromPipeline=$true)]
[object]
$Subscrip... | 0 |
sample_19_93.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 |
chkhash_17.ps1 | # calculate SHA512 of file.
function Get-SHA512([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]'))
{
$stream = $null;
$cryptoServiceProvider = [System.Security.Cryptography.SHA512CryptoServiceProvider];
$hashAlgorithm = new-object $cryptoServiceProvider
$stream = $file.Open... | 0 |
sample_9_62.ps1 | #************************************************
# TS_KernelAuthRPCCheck.ps1
# Version 1.0
# Date: 5-1-2012
# Author: davidcop
# Description: Checks for kernel-mode authentication mismatch between server, web site, and /rpc virtual directory
#************************************************
$varx = Get-Cim... | 0 |
3723.ps1 |
function Get-DataLakeStoreAccountName
{
return getAssetName
}
function Get-ResourceGroupName
{
return getAssetName
}
function Invoke-HandledCmdlet
{
param
(
[ScriptBlock] $Command,
[switch] $IgnoreFailures
)
try
{
&$Command
}
catch
{
if(!$IgnoreFailures)
{
throw;
}
}... | 0 |
sample_31_59.ps1 | #
# Module manifest for module 'OCI.PSModules.Mysql'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Mysql.dll'
# Version number of this module.
ModuleVersion = '77.0.0'
# Supported PSEditions
Compatible... | 0 |
Get-Process -eq PSList.ps1 | ps | % -b {$arr = @()} -p {
$str = "" | select Name, PID, Time
$str.Name = $_.ProcessName
$str.PID = $_.Id
$str.Time = $(try {$_.StartTime} catch {return [DateTime]::MinValue})
$arr += $str
} -end {$arr | sort Time | ft -a}
| 0 |
sample_46_51.ps1 | #
# Module manifest for module 'OCI.PSModules.Vbsinst'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Vbsinst.dll'
# Version number of this module.
ModuleVersion = '75.1.0'
# Supported PSEditions
Compat... | 0 |
sample_16_32.ps1 | #
# Module manifest for module 'OCI.PSModules.Ocicontrolcenter'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Ocicontrolcenter.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported... | 0 |
2098.ps1 |
Describe "Dynamic parameter support in script cmdlets." -Tags "CI" {
BeforeAll {
Class MyTestParameter {
[parameter(ParameterSetName = 'pset1', position=0, mandatory=1)]
[string] $name
}
function foo-bar
{
[CmdletBinding()]
param($pa... | 0 |
Deploy Multiple VMs v1.ps1 | #############################################################
# Deploy-VM.ps1 v1.1
# David Summers 2011/8/2
# Script to deploy VM(s) from Template(s) and set appropriate
# IP config for Windows VMs. Also sets # of CPUs, MemoryMB,
# port group, and several custom attributes.
# Moves deployed VM to specific VMs/Te... | 0 |
1447.ps1 |
function Test-CIisAppPool
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]
$Name
)
Set-StrictMode -Version 'Latest'
Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState
$appPool = Get-CIisAppPool -Name $Name
... | 0 |
2710.ps1 |
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[String]$FileHash,
[Parameter(Mandatory=$False,Position=2)]
[ValidateSet("MD5","SHA1","SHA256","SHA384","SHA512","RIPEMD160")]
[string]$HashType = "SHA256",
[Parameter(Mandatory=$False,Position=3)]
[String]$Ba... | 0 |
1160.ps1 |
$tempDir = $null
$compressedDirPath = $null
$compressedFilePath = $null
$uncompressedDirPath = $null
$uncompressedFilePath = $null
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve)
}
function Start-Test
{
$tempDir = New-TempDirectoryT... | 0 |
2c605667-d02a-4251-bacb-0dae618c9f87.ps1 | function Update-Scopes($siteUrl)
{
[void][reflection.assembly]::Loadwithpartialname("Microsoft.SharePoint") | out-null
[void][reflection.assembly]::Loadwithpartialname("Microsoft.office.server.search") | out-null
$s = [microsoft.sharepoint.spsite]$siteUrl
$sc = [microsoft.office.server.servercontext]::GetCo... | 0 |
1565.ps1 |
function Add-MrStartupVariable {
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Mandatory)]
[ValidateSet('AllUsersAllHosts', 'AllUsersCurrentHost', 'CurrentUserAllHosts', 'CurrentUserCurrentHost')]
$Location
)
$Content = @'
$StartupVars = @()
$StartupVars = Get-Va... | 0 |
Audit File Share Perms.ps1 | Function Get-SharePermissions($ShareName){
$Share = Get-WmiObject win32_LogicalShareSecuritySetting -Filter "name='$ShareName'"
if($Share){
$obj = @()
$ACLS = $Share.GetSecurityDescriptor().Descriptor.DACL
foreach($ACL in $ACLS){
$User = $ACL.Trustee.Name
i... | 0 |
1172.ps1 |
$rootKey = 'hklm:\Software\Carbon\Test\Test-RemoveRegistryKeyValue'
$valueName = 'RegValue'
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve)
}
function Start-Test
{
if( -not (Test-Path $rootKey -PathType Container) )
{
Ne... | 0 |
4169.ps1 | cls
Set-Variable -Name a -Scope Global -Force
Set-Variable -Name Output -Scope Global -Force
Function AddRemovePrograms($KeyName, $DisplayName, $Version){
Set-Variable -Name AddRemKey -Value "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" -Scope Local -Force
... | 0 |
sample_23_78.ps1 | # These Pester tests are for the for parameter-* and ex-path* snippets.
# Take a look at the .vscode\tasks.json file to see how you can create
# and configure a test task runner that will run all the Pester tests
# in your workspace folder.
# To run these Pester tests, press Ctrl+Shift+T or press Ctrl+Shift+P,
#... | 0 |
Invoke-AppAsAdmin.ps1 | #requires -version 2.0
<#
.SYNOPSIS
Script to run executable with alternate credentials as admin.
.DESCRIPTION
This script will try to invoke itself with alternate credentials (using Get-Credential cmdlet) and once it's there it will try to run any executable as elevated.
Designe... | 0 |
4389.ps1 | function Test-RunningAsElevated
{
[CmdletBinding()]
[OutputType([bool])]
Param()
if(-not $script:IsRunningAsElevatedTested -and $script:IsRunningAsElevated)
{
if($script:IsWindows)
{
$wid=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$prp=new-obj... | 0 |
4196.ps1 |
param
(
[string]$ApplicationName = 'quicktime',
[string]$WindowTitle = 'Uninstall Apple Quicktime',
[string]$MSI_Switches = '/qb- /norestart'
)
function Set-ConsoleTitle {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)][String]$Title
)
$host.ui.RawUI.WindowTitle = $Title
}
Function Initi... | 0 |
sample_3_62.ps1 | #************************************************
# TS_RemoteDesktopLServerKB2512845.ps1
# Version 1.0.1
# Date: 5/15/2012
# Author: v-kaw
# Description: [Idea ID 2285] [Windows] Windows Server 2003 TS Licensing server does not renew new versions of TS Per Device CALs
# Rule number: 2285
# Rule URL: //sharepo... | 0 |
sample_58_60.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
<#
PowerShell Diagnostics Module
This module contains a set of wrapper scripts that
enable a user to use ETW tracing in Windows
PowerShell.
#>
$script:Logman="$env:windir\system32\logman.exe"
$script:wsmanlogfile = "$env:wind... | 0 |
Send-HTMLFormattedEmail_8.ps1 | #-------------------------------------------------
# Send-HTMLFormattedEmail
#-------------------------------------------------
# Usage: Used to send an HTML Formatted Email that is based on an XSLT template.
#-------------------------------------------------
function Send-HTMLFormattedEmail{
param ( [string]... | 0 |
sample_67_5.ps1 | #
# Module manifest for module 'Az.StackHCI'
#
# Generated by: Microsoft Corporation
#
# Generated on: 7/31/2024
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'Az.StackHCI.psm1'
# Version number of this module.
ModuleVersion = '2.4.0'
# Supported PSEditions
... | 0 |
New-XVM_7.ps1 | #Examples
<#
New-XVM -Name "WS2012-TestServer01" -SwitchName "Switch(192.168.2.0/24)" -VhdType NoVHD
New-XVM -Name "WS2012-TestServer02" -SwitchName "Switch(192.168.2.0/24)" -VhdType ExistingVHD -VhdPath 'D:\\vhds\\WS2012-TestServer02.vhdx'
New-XVM -Name "WS2012-TestServer03" -SwitchName "Switch(192.168.2.0/24)" ... | 0 |
sample_3_58.ps1 | #************************************************
# TS_2K3CLSIDUserACLCheck.ps1
# Version 1.0.1
# Date: 6/12/2012
# Author: v-kaw
# Description: [Idea ID 4368] [Windows] Windows Logon Slow and Explorer Slow
# Rule number: 4368
# Rule URL: http://sharepoint/sites/rules/Rule Submissions/Forms/DispForm.aspx?ID=4... | 0 |
759.ps1 | param([int]$Count=50, [int]$DelayMilliseconds=200)
function Write-Item($itemCount) {
$i = 1
while ($i -le $itemCount) {
$str = "Output $i"
Write-Output $str
$i = $i + 1
Start-Sleep -Milliseconds $DelayMilliseconds
}
}
function Do-Work($workC... | 0 |
sample_50_82.ps1 | #!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
$pathsep=":"
$env_node_path=$env:NODE_PATH
$new_node_path="C:\Users\abder\component-maker\web\node_modules\.pnpm\@babel+parser@7.23.9\node_modules\@babel\parser\bin\node_modules;C:\Users\abder\component-maker\web\node_modules\.p... | 0 |
sample_43_72.ps1 | ---
name: Request a gRPC C# feature
about: Suggest an idea for this project
labels: kind/enhancement, priority/P2, lang/C#
assignees: apolcyn
---
<!--
PLEASE DO NOT POST A QUESTION HERE.
This form is for bug reports and feature requests ONLY!
For general questions and troubleshooting, please ask/look for answers at ... | 0 |
1553.ps1 |
function Out-MrReverseString {
[CmdletBinding()]
param (
[Parameter(Mandatory,
ValueFromPipeline)]
[string[]]$String
)
PROCESS {
foreach ($s in $String) {
$Array = $s -split ''
[System.Array]::Reverse($Array)
Write-Outpu... | 0 |
sample_31_93.ps1 | # <copyright>
# INTEL CONFIDENTIAL
#
# Copyright 2021 Intel Corporation
#
# This software and the related documents are Intel copyrighted materials, and your use of
# them is governed by the express license under which they were provided to you ("License").
# Unless the License provides otherwise, you may not us... | 0 |
sample_33_19.ps1 | #
# Module manifest for module 'OCI.PSModules.Servicecatalog'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Servicecatalog.dll'
# Version number of this module.
ModuleVersion = '74.1.0'
# Supported PSE... | 0 |
SqlProxy_5.psm1.ps1 | # ---------------------------------------------------------------------------
### <Author>
### Chad Miller
### </Author>
### <Description>
### Based on functions in SQLPSX. SqlProxy.psm1 module is used for administering
### SQL Server logins, users, and roles. Designed to be used with PS Remoting.
### All actio... | 0 |
1829.ps1 |
Describe "Get-Service cmdlet tests" -Tags "CI" {
BeforeAll {
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
if ( -not $IsWindows ) {
$PSDefaultParameterValues["it:skip"] = $true
}
}
AfterAll {
$global:PSDefaultParameterValues = $originalDefaultParameterVal... | 0 |
sample_51_7.ps1 | #!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
$pathsep=":"
$env_node_path=$env:NODE_PATH
$new_node_path="C:\Users\abder\component-maker\web\node_modules\.pnpm\browserslist@4.22.3\node_modules\browserslist\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\br... | 0 |
sample_12_39.ps1 | #************************************************
# DC_Setup_AppCompat.ps1
# Version 1.0
# Date: 2009-2019
# Author: Walter Eder (waltere@microsoft.com)
# Description: Collects additional AppCompat information.
# Called from: TS_AutoAddCommands_Setup.ps1
#*******************************************************
... | 0 |
3115.ps1 |
function Get-TrustedHost
{
[CmdletBinding()]
param(
)
Begin{
}
Process{
$TrustedHost_Path = "WSMan:\localhost\Client\TrustedHosts"
try{
[String]$TrustedHost_Value = (Get-Item -Path $TrustedHost_Path).Value
}
catch{
throw... | 0 |
sample_10_9.ps1 | # 2023-02-24 WalterE mod Trap #we#
$startTime_AutoAdd = Get-Date
trap [Exception]{
WriteTo-StdOut "$($_.InvocationInfo.ScriptName)($($_.InvocationInfo.ScriptLineNumber)): $_" -shortformat; continue
Write-Host "$($_.InvocationInfo.ScriptName)($($_.InvocationInfo.ScriptLineNumber)): $_"
}
Write-Host -Background... | 0 |
sample_62_53.ps1 | #
# Module manifest for module 'OCI.PSModules.Loggingsearch'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Loggingsearch.dll'
# Version number of this module.
ModuleVersion = '88.1.0'
# Supported PSEdi... | 0 |
838.ps1 | Param(
[parameter(Mandatory=$true)]
$CsvFilePath
)
$ErrorActionPreference = "Stop"
$scriptsPath = $PSScriptRoot
if ($PSScriptRoot -eq "") {
$scriptsPath = "."
}
. "$scriptsPath\asr_logger.ps1"
. "$scriptsPath\asr_common.ps1"
. "$scriptsPath\asr_csv_processor.ps1"
Function CheckParameter($logger, [string... | 0 |
SharePoint Large Lists_1.ps1 | [reflection.assembly]::loadwithpartialname("Microsoft.SharePoint")
$cs = [microsoft.sharepoint.administration.spwebservice]::ContentService
$global:largeListThreshhold = 2000
function Is-Admin([Microsoft.SharePoint.SPRoleAssignment]$roleAssignment)
{
return (($roleAssignment.roledefinitionbindings | where { ($_... | 0 |
sample_27_9.ps1 | #
# Module manifest for module 'OCI.PSModules.Onesubscription'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Onesubscription.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported P... | 0 |
54.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 ($Aa... | 0 |
3777.ps1 |
function Test-ServerEndpoint2
{
$resourceGroupName = Get-ResourceGroupName
Write-Verbose "RecordMode : $(Get-StorageTestMode)"
try
{
$storageSyncServiceName = Get-ResourceName("sss")
$syncGroupName = Get-ResourceName("sg")
$serverEndpointName = Get-Re... | 0 |
sample_63_92.ps1 | #
# Module manifest for module 'Az.RedisCache'
#
# Generated by: Microsoft Corporation
#
# Generated on: 7/31/2024
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'Az.RedisCache.psm1'
# Version number of this module.
ModuleVersion = '1.10.0'
# Supported PSEditi... | 0 |
sample_56_5.ps1 |
///////////////////////////////////////////////////////////////////////////////
// Helper to set a designer prop
///////////////////////////////////////////////////////////////////////////////
function setDesignerProp(tname, ttype, tvalue) {
var trait = document.designerProps.getOrCreateTrait(tname, ttype, 0)... | 0 |
Select-TextOutput.ps1 | ##############################################################################\n##\n## Select-TextOutput\n##\n## From Windows PowerShell Cookbook (O'Reilly)\n## by Lee Holmes (http://www.leeholmes.com/guide)\n##\n##############################################################################\n\n<#\n\n.SYNOPSIS\n\nSearch... | 0 |
Get-DellWarranty_2.ps1 | function Get-DellWarranty {
<#
.Synopsis
Provides warranty information for one or more Dell service tags.
.Description
Queries the Dell Website for a list of service tags and returns the warranty information as a custom object.
If a service tag has multiple warranties, they are... | 0 |
sample_8_63.ps1 | <#
.SYNOPSIS
Collects basic information about the installed instance of WSUS Server
.DESCRIPTION
Collects basic information about the installed instance of WSUS Server and generates two files:
COMPUTERNAME_WSUS_BasicInfo.txt
(Optional) COMPUTERNAME_WSUS_UpdateApprovals.txt
.PARAMETER GetApprovedUpdates
(Opt... | 0 |
3309.ps1 |
function Get-Plugin {
[PoshBot.BotCommand(
Aliases = ('gp', 'getplugin')
)]
[cmdletbinding()]
param(
[parameter(Mandatory)]
$Bot,
[parameter(Position = 0)]
[string]$Name,
[parameter(Position = 1)]
[string]$Version
)
if ($PSBoundPar... | 0 |
sample_27_90.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 = '74.1.0'
# Supported... | 0 |
sample_7_61.ps1 | # diag_sha.psm1
# Created by tdimli
# March 2020
#
# Diagnostic functions for SHA area
# version
$SHA_version = "1.0.200425.0"
# Area and Area/Component arrays
# Example: $AREA = @("Component1", "Component2")
$SHA = @()
#Component/Diagnostic Function arrays
# Example: $Component1 = @("Diag_Func1", "Dia... | 0 |
sample_42_64.ps1 | <#
.SYNOPSIS
Demonstrates how to write a command that works with paths that do
not allow wildards but must exist.
.DESCRIPTION
This command does not require a LiteralPath parameter because the
Path parameter can handle paths that use wildcard characters. That's
because this command does not ... | 0 |
756.ps1 | $ModuleManifestName = 'SampleModule.psd1'
Import-Module $PSScriptRoot\..\$ModuleManifestName
Describe 'Module Manifest Tests' {
It 'Passes Test-ModuleManifest' {
Test-ModuleManifest -Path $PSScriptRoot\..\$ModuleManifestName
$? | Should Be $true
}
}
| 0 |
3887.ps1 |
function Get-ResourceGroupName
{
return getAssetName
}
function Get-WorkspaceCollectionName
{
return getAssetName
}
function Clean-ResourceGroup($rgname)
{
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback) {
... | 0 |
Set-Domain_1.ps1 | function Set-Domain {
param( [switch]$help,
[string]$domain=$(read-host "Please specify the domain to join"),
[System.Management.Automation.PSCredential]$credential = $(Get-Crdential)
)
$usage = "`$cred = get-credential `n"
$usage += "Set-AvaDomain -domain corp.avanade.org -credential `$cred`n"
... | 0 |
New-ODataServiceProxy.ps1 | function New-ODataServiceProxy {
#.Synopsis
# Creates a proxy class for an odata web service
# YOU NEED TO BE VERY CAREFUL NOT TO OUTPUT THE PROXY OBJECT TO THE POWERSHELL HOST!
#.Description
# Uses the data service client utility (DataSvcUtil.exe) to generate a proxy class (and types for all objects) for an O... | 0 |
2440.ps1 | $hyperVHost = 'HYPERVSRV'
$vmUptimes = Get-VM -ComputerName $hyperVHost | select name, uptime, @{ n = 'Type'; e= { 'VM' } }
$wmiParams = @{
'ComputerName' = $hyperVHost
'Class' = 'Win32_OperatingSystem'
}
$hostUptime = Get-WmiObject @wmiParams | select @{ n = 'Uptime'; e = { (Get-Date) - ($_.ConvertToDateTime($_.Las... | 0 |
274.ps1 | function New-Password
{
[CmdletBinding()]
PARAM
(
[ValidateNotNull()]
[int]$Length = 12,
[ValidateRange(1,256)]
[Int]$Count = 1
)
BEGIN
{
$PasswordCharCodes = { 33..126 }.invoke()
34, 39, 46, 47, 49, 60, 62, 96, 48, 79, 108, 124 | ForEach-Object { [void]$Passwor... | 0 |
New-XVM_14.ps1 | #EXAMPLES
<#
New-XVM -ComputerName HYPERVSVR02 -Name "WS2012-TESTSVR01" -SwitchName "External(192.168.1.0/24)" -VhdType NoVHD
New-XVM -ComputerName HYPERVSVR02 -Name "WS2012-TESTSVR02" -SwitchName "External(192.168.1.0/24)" -VhdType ExistingVHD -VhdPath D:\\vhds\\WS2012-TESTSVR02.vhdx
New-XVM -ComputerName HYPERVSV... | 0 |
1514.ps1 |
function Assert-True
{
[CmdletBinding()]
param(
[Parameter(Position=0)]
[object]
$Condition,
[Parameter(Position=1)]
[string]
$Message
)
Set-StrictMode -Version 'Latest'
if( -not $condition )
{
Fail ... | 0 |
sample_10_24.ps1 | #!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
$pathsep=":"
$env_node_path=$env:NODE_PATH
$new_node_path="D:\a\1\s\node_modules\.pnpm\typescript@4.9.5\node_modules\typescript\bin\node_modules;D:\a\1\s\node_modules\.pnpm\typescript@4.9.5\node_modules\typescript\node_modules;D... | 0 |
Move-LockedFile.ps1 | ##############################################################################\n##\n## Move-LockedFile\n##\n## From Windows PowerShell Cookbook (O'Reilly)\n## by Lee Holmes (http://www.leeholmes.com/guide)\n##\n##############################################################################\n\n<#\n\n.SYNOPSIS\n\nRegister... | 0 |
484.ps1 |
function Remove-HostFileEntry{
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[String]
$IP,
[Parameter(Mandatory=$false)]
[String]
$DNS
)
$HostFile = "$env:windir\System32\drivers\etc\hosts"
get-content $HostFile | %{
if($_.StartsWith("
... | 0 |
2236.ps1 |
$DailyBackupFolder = "\\fileshare\ContentLibrary\Daily"
$ArchiveFolder = "\\fileshare\ContentLibrary\Archive"
$Date = (Get-Date).ToShortDateString()
$DateKeep = (Get-Date).AddDays(-2).ToShortDateString()
$DailyFolder = "$($ArchiveFolder)\$($Date)"
if (-not(Test-Path -Path $DailyFolder)) {
New-Item -Type Directo... | 0 |
2079.ps1 |
Describe 'Exceptions flow for classes' -Tags "CI" {
$canaryHashtable = @{}
$iss = [initialsessionstate]::CreateDefault()
$iss.Variables.Add([System.Management.Automation.Runspaces.SessionStateVariableEntry]::new('canaryHashtable', $canaryHashtable, $null))
$iss.Commands.Add([System.Management.Automa... | 0 |
Publish-File_1.ps1 | # Note that this version will not descend directories.
function Publish-File {
param (
[parameter( Mandatory = $true, HelpMessage="URL pointing to a SharePoint document library (omit the '/forms/default.aspx' portion)." )]
[System.Uri]$Url,
[system.Management.Automation.PSCredential]$Credential,
[paramet... | 0 |
1791.ps1 |
Describe "Set-Location" -Tags "CI" {
BeforeAll {
$startDirectory = Get-Location
if ($IsWindows)
{
$target = "C:\"
}
else
{
$target = "/"
}
}
AfterAll {
Set-Location $startDirectory
}
It "Should be able to b... | 0 |
Get-DellWarranty_4.ps1 | function Get-DellWarranty {
<#
.Synopsis
Provides warranty information for one or more Dell service tags.
.Description
Queries the Dell Website for a list of service tags and returns the warranty information as a custom object.
If a service tag has multiple warranties, they are... | 0 |
1223.ps1 |
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve)
$ShareName = $null
$SharePath = $TestDir
$fullAccessGroup = 'Carbon Share Full'
$changeAccessGroup = 'CarbonShareChange'
$readAccessGroup = 'CarbonShareRead'
$noAccessGroup = 'CarbonShareNone'
$Remarks = [Guid]::NewGuid().... | 0 |
sample_13_3.ps1 | ConvertFrom-StringData @'
id_clustercsvd=Cluster Shared Volume information
id_clustercsvdesc=Obtaining information about Cluster Shared Volumes
'@
# SIG # Begin signature block
# MIIoPAYJKoZIhvcNAQcCoIIoLTCCKCkCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
... | 0 |
sample_12_10.ps1 | #
# Module manifest for module 'OCI.PSModules.Blockchain'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Blockchain.dll'
# Version number of this module.
ModuleVersion = '74.1.0'
# Supported PSEditions
... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.