full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/1270.ps1 | 1270.ps1 |
function Start-CDscPullConfiguration
{
[CmdletBinding(DefaultParameterSetName='WithCredentials')]
param(
[Parameter(Mandatory=$true,ParameterSetName='WithCredentials')]
[string[]]
$ComputerName,
[Parameter(ParameterSetName='WithCredentials')]
[PSCredential... |
combined_dataset/train/non-malicious/sample_17_81.ps1 | sample_17_81.ps1 | $ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
Set-Variable -Option Constant -Name CameraPnPClassName -Value "Camera"
Set-Variable -Option Constant -Name ImagePnPClassName -Value "Image"
Set-Variable -Option Constant -Name DeviceParametersKeyName -Value "Device Para... |
combined_dataset/train/non-malicious/sample_40_91.ps1 | sample_40_91.ps1 | # Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved.
Function Get-AMTHardwareAsset {
<#
.Synopsis
Shows hardware information about the system
.Description
This Cmdlet returns the hardware information from clients that have Intel Active Management Technology (AMT) firmware version 3.2 ... |
combined_dataset/train/non-malicious/sample_22_21.ps1 | sample_22_21.ps1 | #
# Module manifest for module 'OCI.PSModules.Accessgovernancecp'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Accessgovernancecp.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Suppo... |
combined_dataset/train/non-malicious/2914.ps1 | 2914.ps1 | Framework "1.1.0"
task default -depends MsBuild
task MsBuild {
if ( $IsMacOS -OR $IsLinux ) {
$output = &dotnet build -version -nologo 2>&1
Assert ($output -NotLike "15.1") '$output should contain 15.1'
}
}
|
combined_dataset/train/non-malicious/3872.ps1 | 3872.ps1 |
function Test-GetWebApp
{
$rgname = Get-ResourceGroupName
$wname = Get-WebsiteName
$wname2 = Get-WebsiteName
$location = Get-WebLocation
$whpName = Get-WebHostPlanName
$tier = "Shared"
$apiversion = "2015-08-01"
$resourceType = "Microsoft.Web/sites"
try
{
New-AzResourceGroup -Name $rgna... |
combined_dataset/train/non-malicious/TabExpansion for V2CTP_4.ps1 | TabExpansion for V2CTP_4.ps1 | ## Tab-Completion
#################
## For V2CTP3.
## This won't work on V1 and V2CTP and V2CTP2.
## Please dot souce this script file.
## In first loading, it may take a several minutes, in order to generate ProgIDs and TypeNames list.
##
## What this can do is:
##
## [datetime]::n<tab>
## [datetime]::now.d... |
combined_dataset/train/non-malicious/2783.ps1 | 2783.ps1 |
if (Get-Command logparser.exe) {
$lpquery = @"
SELECT
COUNT(Protocol,
substr(ForeignAddress, 0, last_index_of(substr(ForeignAddress, 0, last_index_of(ForeignAddress, '.')), '.')),
State,
Component,
Process) as Cnt,
Protocol,
substr(ForeignAddress, 0, la... |
combined_dataset/train/non-malicious/sample_25_69.ps1 | sample_25_69.ps1 | # ------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
# ------------------------------------------------------------
[CmdletBinding(DefaultParamet... |
combined_dataset/train/non-malicious/sample_21_63.ps1 | sample_21_63.ps1 | # Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved.
Function Set-AMTSystemDefense {
<#
.Synopsis
Enables Intel Active Management Technology System Defense
.Description
This CmdLet disables network access using Intel Active Management Technology (AMT) System Defense from clients tha... |
combined_dataset/train/non-malicious/sample_33_81.ps1 | sample_33_81.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... |
combined_dataset/train/non-malicious/sample_19_80.ps1 | sample_19_80.ps1 | ---
title: Powershell
description: Powershell snippets on the rocks.
---
## [cotrWhileLoop](/snippets/cotrwhileloop)
PowerShell While Loop
```powershell
while (${1:condition}) {
# Your code here
}
```
## [cotrEqual](/snippets/cotrequal)
PowerShell Equal To
```powershell
-eq
```
## [cotrNotEqual](/snippets/cotr... |
combined_dataset/train/non-malicious/Add-ObjectCollector.ps1 | Add-ObjectCollector.ps1 | ##############################################################################\n##\n## Add-ObjectCollector\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\nAdds... |
combined_dataset/train/non-malicious/sample_43_77.ps1 | sample_43_77.ps1 | #
# Module manifest for module 'OCI.PSModules.Vault'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Vault.dll'
# Version number of this module.
ModuleVersion = '83.1.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/sample_35_31.ps1 | sample_35_31.ps1 | # <copyright>
# INTEL CONFIDENTIAL
#
# Copyright 2022 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... |
combined_dataset/train/non-malicious/New-Choice.ps1 | New-Choice.ps1 | function New-Choice {
<#
.SYNOPSIS
The New-Choice function is used to provide extended control to a script author who writing code
that will prompt a user for information.
.PARAMETER Choices
An Array of Choices, ie Yes, No and Maybe
.PARAMETER Caption
Caption to present to end ... |
combined_dataset/train/non-malicious/2923.ps1 | 2923.ps1 | task default -depends Test
task Test -depends Compile, Clean {
Assert $false "This fails."
}
task Compile -depends Clean {
"Compile"
}
task Clean {
"Clean"
}
taskTearDown {
param($task)
Assert ($task.Name -eq $psake.context.Peek().currentTaskName) 'TaskName should match'
if ($task.Success) ... |
combined_dataset/train/non-malicious/2984.ps1 | 2984.ps1 | Set-StrictMode -Version Latest
$os = InModuleScope -ModuleName Pester { GetPesterOs }
if ("Windows" -ne $os) {
return
}
Describe "General" {
It "creates a drive location called TestRegistry:" {
"TestRegistry:\" | Should -Exist
}
It "is located in Pester key in HKCU" {
$testRegist... |
combined_dataset/train/non-malicious/767.ps1 | 767.ps1 |
function Invoke-MyCommand {
Write-Output "My command's function was executed!"
}
Register-EditorCommand -Verbose `
-Name "MyModule.MyCommandWithFunction" `
-DisplayName "My command with function" `
-Function Invoke-MyCommand
Register-EditorCommand -Verbose `
-Name "MyModule.MyCommandWithScr... |
combined_dataset/train/non-malicious/sample_6_67.ps1 | sample_6_67.ps1 | #************************************************
# TS_PowerCFG.ps1
# Version 3.0
# Date: 14/03/2013
# Author: v-kaw
# Description: Running powercfg.exe to obtain power settings information
# Note: This is the third edition of this file. Ideal ID for this edition is 6292.
# Ideal ID for second edition is ... |
combined_dataset/train/non-malicious/422.ps1 | 422.ps1 | Register-PSFTeppScriptblock -Name 'PSFramework-config-validation' -ScriptBlock { [PSFramework.Configuration.ConfigurationHost]::Validation.Keys } |
combined_dataset/train/non-malicious/3096.ps1 | 3096.ps1 | function Verify-False {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual
)
if ($Actual) {
throw [Exception]"Expected `$false but got '$Actual'."
}
$Actual
}
|
combined_dataset/train/non-malicious/lazywinadmin.com.ps1 | lazywinadmin.com.ps1 | Get-WmiObject Win32_Service -ComputerName . |`
where {($_.startmode -like "*auto*") -and `
($_.state -notlike "*running*")}|`
select DisplayName,Name,StartMode,State|ft -AutoSize
|
combined_dataset/train/non-malicious/2384.ps1 | 2384.ps1 |
function Invoke-SqlDatabaseBackupToFile
{
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Database,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-Connection -ComputerName $_ -Quiet -Count 1 })]
[string]$Server,
[Parameter(Mandatory... |
combined_dataset/train/non-malicious/Get-StructFromMemory.ps1 | Get-StructFromMemory.ps1 | function Get-StructFromMemory
{
<#
.SYNOPSIS
Marshals data from an unmanaged block of memory in an arbitrary process to a newly allocated managed object of the specified type.
Author: Matthew Graeber (@mattifestation)
License: BSD 3-Clause
.DESCRIPTION
Get-StructFromMemory is similar to the Marshal.Ptr... |
combined_dataset/train/non-malicious/2201.ps1 | 2201.ps1 |
[CmdletBinding(SupportsShouldProcess)]
param(
[parameter(Mandatory=$true, HelpMessage="Site server where the SMS Provider is installed")]
[ValidateScript({Test-Connection -ComputerName $_ -Count 2})]
[string]$SiteServer,
[parameter(Mandatory=$true, HelpMessage="Value in WQL query statement to look for"... |
combined_dataset/train/non-malicious/sample_31_25.ps1 | sample_31_25.ps1 | # Localized 05/07/2022 02:58 AM (GMT) 303:7.0.30723 TestDtc.psd1
ConvertFrom-StringData @'
###PSLOC start localizing
FirewallRuleEnabled="{0}: Firewall rule for {1} is enabled."
FirewallRuleDisabled="{0}: Firewall rule for {1} is disabled. This computer cannot participate in network transactions."
Cmdl... |
combined_dataset/train/non-malicious/3377.ps1 | 3377.ps1 | [CmdletBinding()]
Param(
[Parameter(Mandatory = $True, Position = 0)]
[string]$ReleaseDate,
[Parameter(Mandatory = $True, Position = 1)]
[string]$ReleaseVersion,
[Parameter(Mandatory = $False, Position = 2)]
[string]$PathToRepo
)
function UpdateCurrentDoc([string]$PathToCurrentDoc, [string]$... |
combined_dataset/train/non-malicious/sample_64_31.ps1 | sample_64_31.ps1 | ##########################################################################
# DELL PROPRIETARY INFORMATION
#
# This software is confidential. Dell Inc., or one of its subsidiaries, has supplied this
# software to you under the terms of a license agreement,nondisclosure agreement or both.
# You may not copy, disclose, o... |
combined_dataset/train/non-malicious/sample_53_63.ps1 | sample_53_63.ps1 | # region Generated
# Load the private module dll
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.ScheduledQueryRule.private.dll')
# Load the internal module
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.ScheduledQueryRule.internal.psm1'
if(Test-Path $internalM... |
combined_dataset/train/non-malicious/4109.ps1 | 4109.ps1 |
Clear-Host
Set-Variable -Name OS -Scope Global -Force
Set-Variable -Name RelativePath -Scope Global -Force
Function RenameWindow ($Title) {
Set-Variable -Name a -Scope Local -Force
$a = (Get-Host).UI.RawUI
$a.WindowTitle = $Title
Remove-Variable -Na... |
combined_dataset/train/non-malicious/Get-Parameter_5.ps1 | Get-Parameter_5.ps1 | function Get-Parameter ( $Cmdlet, [switch]$ShowCommon ) {
foreach ($paramset in (Get-Command $Cmdlet).ParameterSets){
$Output = @()
foreach ($param in $paramset.Parameters) {
if ( !$ShowCommon ) {
if ($param.aliases -match "vb|db|ea|wa|ev|wv|ov|ob") { continue }
}
$process = "" | Select-Object ... |
combined_dataset/train/non-malicious/2004.ps1 | 2004.ps1 |
Describe "ProviderIntrinsics Tests" -tags "CI" {
BeforeAll {
setup -d TestDir
}
It 'If a childitem exists, HasChild method returns $true' {
$ExecutionContext.InvokeProvider.ChildItem.HasChild("$TESTDRIVE") | Should -BeTrue
}
It 'If a childitem does not exist, HasChild method return... |
combined_dataset/train/non-malicious/New-GenericObject.ps1 | New-GenericObject.ps1 | ##############################################################################\n##\n## New-GenericObject\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\nCreate... |
combined_dataset/train/non-malicious/sample_35_91.ps1 | sample_35_91.ps1 | #
# Module manifest for module 'OCI.PSModules'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
# RootModule = ''
# Version number of this module.
ModuleVersion = '80.0.0'
# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'
# ID u... |
combined_dataset/train/non-malicious/Start-Presentation_1.ps1 | Start-Presentation_1.ps1 | if(-not(get-command New-System.Windows.Window -EA 0)){ Import-Module PowerBoots }
Add-BootsTemplate $PSScriptRoot\\PresentationFrame.xaml
$name = [System.Windows.Navigation.JournalEntry]::NameProperty
[double]$global:zoomLevel = 1
$SlideCount = 0
function Start-Zoom {
PARAM(
[Parameter(Position=0)]
... |
combined_dataset/train/non-malicious/sample_62_97.ps1 | sample_62_97.ps1 | #
# Module manifest for module 'OCI.PSModules.Events'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Events.dll'
# Version number of this module.
ModuleVersion = '88.1.0'
# Supported PSEditions
Compatib... |
combined_dataset/train/non-malicious/sample_43_12.ps1 | sample_43_12.ps1 | #This script converts securestring to plaintext
param(
[Parameter(Mandatory, ValueFromPipeline)]
[System.Security.SecureString]
${SecureString}
)
$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString)
try {
$plaintext = [System.Runtime.InteropServices.Marshal]::... |
combined_dataset/train/non-malicious/3088.ps1 | 3088.ps1 | function Verify-Same {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual,
[Parameter(Mandatory = $true, Position = 0)]
$Expected
)
if (-not [object]::ReferenceEquals($Expected, $Actual)) {
throw [Exception]"Expected the objects to be the same instance but they w... |
combined_dataset/train/non-malicious/269.ps1 | 269.ps1 | function Get-ADDirectReports
{
[CmdletBinding()]
PARAM (
[Parameter(Mandatory)]
[String[]]$Identity,
[Switch]$Recurse
)
BEGIN
{
TRY
{
IF (-not (Get-Module -Name ActiveDirectory)) { Import-Module -Name ActiveDirectory -ErrorAction 'Stop' -Verbo... |
combined_dataset/train/non-malicious/sample_7_35.ps1 | sample_7_35.ps1 | #
# Module manifest for module 'OCI.PSModules.Ospgateway'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Ospgateway.dll'
# Version number of this module.
ModuleVersion = '93.0.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/Set Active Sync DeviceID.ps1 | Set Active Sync DeviceID.ps1 | # Requires a connection to Exchange Server, or Exchange Management Shell
$s = New-PSSession -ConfigurationName Microsoft.Exchange -Name ExchMgmt -ConnectionUri http://ex14.domain.local/PowerShell/ -Authentication Kerberos
Import-PSSession $s
# Get all Client Access Server properties for all mailboxes with an Act... |
combined_dataset/train/non-malicious/sample_27_86.ps1 | sample_27_86.ps1 | #
# Script module for module 'Az.Monitor' that is executed when 'Az.Monitor' is imported in a PowerShell session.
#
# Generated by: Microsoft Corporation
#
# Generated on: 05/16/2024 06:33:08
#
$PSDefaultParameterValues.Clear()
Set-StrictMode -Version Latest
function Test-DotNet
{
try
{
... |
combined_dataset/train/non-malicious/Upgrade VM's to v7.ps1 | Upgrade VM's to v7.ps1 | Function PowerOn-VM($vm){
Start-VM -VM $vm -Confirm:$false -RunAsync | Out-Null
do {
$vmview = get-VM $vm | Get-View
$status = $vmview.Guest.ToolsStatus
Write-Host $vm is starting! -ForegroundColor Yellow
sleep 5
}until(($status -match "toolsOld") -or ($status -match "toolsOk"))
... |
combined_dataset/train/non-malicious/sample_65_14.ps1 | sample_65_14.ps1 | #=======================================================================================================================================================================
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# Description:
# UnzipAndCopyMDS.ps1
# Kill all running Monitoring processes an... |
combined_dataset/train/non-malicious/Select-TextOutput.ps1 | 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... |
combined_dataset/train/non-malicious/sample_40_37.ps1 | sample_40_37.ps1 | @{
RootModule = 'PSModule.psm1'
ModuleVersion = '2.2.5'
GUID = '1d73a601-4a6c-43c5-ba3f-619b18bbb404'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = '(c) Microsoft Corporation. All rights reserved.'
D... |
combined_dataset/train/non-malicious/sample_66_72.ps1 | sample_66_72.ps1 | #
# Module manifest for module 'OCI.PSModules.Osmanagementhub'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Osmanagementhub.dll'
# Version number of this module.
ModuleVersion = '86.2.0'
# Supported P... |
combined_dataset/train/non-malicious/1214.ps1 | 1214.ps1 |
Set-StrictMode -Version 'Latest'
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve)
$sourceRoot = $null;
$destinationRoot = $null
function Assert-Copy
{
param(
$SourceRoot,
$DestinationRoot,
[Switch]
$Recurse
)
Get-ChildItem -P... |
combined_dataset/train/non-malicious/sample_0_60.ps1 | sample_0_60.ps1 | #************************************************
# DC_HyperVBasicInfo.ps1
# Version 1.0
# Date: 4-7-2015
# Author: Ryutaro Hayashi <Ryutaro.Hayashi@microsoft.com>
# Ported to SDP and included in HyperV SDP by Tim Springston <tspring@microsoft.com>
# Description: Data collection for hyperv.
#********************... |
combined_dataset/train/non-malicious/sample_3_61.ps1 | sample_3_61.ps1 | ConvertFrom-StringData @'
id_systemfiles_title=System Files
id_systemfiles_status=Collecting System Files
id_systemfilesdirectorylistings_title=System Files Directory Listings
id_systemfilesdirectorylistings_status=Collecting System Files Directory Listings
id_systemfilesacllistings_title=System Files ACL Listings... |
combined_dataset/train/non-malicious/WCF code coverage.ps1 | WCF code coverage.ps1 | param($msBuildTarget, $configurationName, [bool]$deleteInstrumentedAssemblies)
#-------------------------------------
# Script to compile coverage for a WCF
# solution running in IIS.
# See:
# http://geekswithblogs.net/EltonStoneman/archive/2011/10/14/end-to-end-wcf-code-coverage-with-powershell.aspx
#-------... |
combined_dataset/train/non-malicious/4241.ps1 | 4241.ps1 |
function Get-PassPol
{
$domain = [ADSI]"WinNT://$env:userdomain"
$Name = @{Name='DomainName';Expression={$_.Name}}
$MinPassLen = @{Name='Minimum Password Length (Chars)';Expression={$_.MinPasswordLength}}
$MinPassAge = @{Name='Minimum Password Age (Days)';Expression={$_.MinPasswordAge.value/86400}}
$MaxPassAge = ... |
combined_dataset/train/non-malicious/35.ps1 | 35.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... |
combined_dataset/train/non-malicious/38d536b5-87f9-4725-b346-64260dcc55ec.ps1 | 38d536b5-87f9-4725-b346-64260dcc55ec.ps1 | function Invoke-JQuery
{
<#
.SYNOPSIS
Function to Invoke JQuery commands via IE COM
.DESCRIPTION
Invokes JQuery (or plain Javascript) commands via InternetExplorer.Application COM object,
after initial injection of JQuery reference in header section.
Useful to utilize JQuery selec... |
combined_dataset/train/non-malicious/sample_21_26.ps1 | sample_21_26.ps1 | ###########################################################
#
# 'ExtensionService' module
#
###########################################################
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
Import-Module "$PSScriptRoot\ServiceHelper.psm1"
$script:GCInstallPath = "$PSScriptRoot\..... |
combined_dataset/train/non-malicious/4399.ps1 | 4399.ps1 | function Get-PackageManagementProviderName
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[Uri]
$Location
)
$PackageManagementProviderName = $null
$loc = Get-LocationString -LocationUri $Location
$providers = PackageManag... |
combined_dataset/train/non-malicious/sample_34_72.ps1 | sample_34_72.ps1 | #
# Module manifest for module 'Az.ServiceBus'
#
# Generated by: Microsoft Corporation
#
# Generated on: 5/16/2024
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'Az.ServiceBus.psm1'
# Version number of this module.
ModuleVersion = '4.0.0'
# Supported PSEditio... |
combined_dataset/train/non-malicious/sample_50_61.ps1 | sample_50_61.ps1 | ConvertFrom-StringData @'
FailoverClustersModuleRequired=Gerekli PowerShell modülü (FailoverClusters) bulunamadı. Yüklemek için Roller ve Özellikler Aracı'nı kullanın: Uzak Sunucu Yönetim Araçları | Özellik Yönetim Araçları | Yük Devretme Kümelemesi Araçları | Windows PowerShell İçin Yük Devretme Küme Modülü.
'@
#... |
combined_dataset/train/non-malicious/1069.ps1 | 1069.ps1 |
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve)
}
function Test-ShouldTestUncPath
{
Assert-True (Test-UncPath -Path '\\computer\share')
}
function Test-ShouldTestRelativePath
{
Assert-False (Test-UncPath -Path '..\..\foo\bar')
}... |
combined_dataset/train/non-malicious/sample_9_20.ps1 | sample_9_20.ps1 | #************************************************
# DC_DfsrInfo.ps1
# Version 1.2.0
# Date: 4/19/2010
# By Craig Landis (clandis@microsoft.com)
#************************************************
# 2019-03-17 WalterE added Trap #_# nneds check for DFSrDiag.exe / OSversion?
# 2023-02-08 fix 'CHOICE /T 20 /C 123q'
... |
combined_dataset/train/non-malicious/sample_1_54.ps1 | sample_1_54.ps1 | // ==================================================================
// DCIM_CLPConcreteJob
// ==================================================================
// Class: DCIM_CLPConcreteJob
[ dynamic, provider("dcismprovider")]
class DCIM_CLPConcreteJob : CIM_ConcreteJob
{
[Write, Description (
... |
combined_dataset/train/non-malicious/New-MAML.ps1 | New-MAML.ps1 | #Requires -version 2.0
#Generates External MAML Powershell help file for any loaded cmdlet or function
#Note: Requires Joel Bennet's New-XML script from http: //www.poshcode.com/1244
#place New-XML in same directory as New-MAML
#Once the XML/MAML file is generated, you'll need to fill in the TODO items and the para... |
combined_dataset/train/non-malicious/sample_16_68.ps1 | sample_16_68.ps1 | #
# Module manifest for module 'OCI.PSModules.Vnmonitoring'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Vnmonitoring.dll'
# Version number of this module.
ModuleVersion = '73.1.0'
# Supported PSEditi... |
combined_dataset/train/non-malicious/sample_42_56.ps1 | sample_42_56.ps1 | #
# Module manifest for module 'OCI.PSModules.Ailanguage'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Ailanguage.dll'
# Version number of this module.
ModuleVersion = '73.1.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/sample_45_62.ps1 | sample_45_62.ps1 | None |
combined_dataset/train/non-malicious/sample_42_48.ps1 | sample_42_48.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function Test-ScriptExtent {
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
[OutputType([bool], ParameterSetName='__AllParameterSets')]
[OutputType([System.Management.Automation.Language.IScriptExten... |
combined_dataset/train/non-malicious/sample_61_15.ps1 | sample_61_15.ps1 | # ------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
# ------------------------------------------------------------
function Publish-NewServiceFa... |
combined_dataset/train/non-malicious/sample_62_58.ps1 | sample_62_58.ps1 | function EnsureAdminPrivileges([String]$mesageOnError)
{
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = new-object Security.Principal.WindowsPrincipal $identity
if (!($principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)))
{
Write-Error $m... |
combined_dataset/train/non-malicious/LibraryMSCS_1.ps1 | LibraryMSCS_1.ps1 | # ------------------------------------------------------------------------
### <Script>
### <Author>
### Chad Miller
### </Author>
### <Description>
### Defines functions for working with Microsoft Cluster Service (MSCS)
### </Description>
### <Usage>
### . ./LibraryMSCS.ps1
### </Usage>
### </Script>
# --... |
combined_dataset/train/non-malicious/3712.ps1 | 3712.ps1 |
function Test-AzureRmIotHubRoutingLifecycle
{
$azureStorageResourceGroupName = 'pshardcodedrg1234'
$azureStorageSubscriptionId = '91d12660-3dec-467a-be2a-213b5544ddc0'
$ascConnectionString = 'DefaultEndpointsProtocol=https;AccountName=pshardcodedstorage1234;AccountKey=W1ujKNLtPmMtaNqZfOCUU5cn... |
combined_dataset/train/non-malicious/3631.ps1 | 3631.ps1 |
function Test-CreateServerCommunicationLink
{
$locationOverride = "North Europe"
$serverVersion = "12.0"
$rg = Create-ResourceGroupForTest $locationOverride
$server1 = Create-ServerForTest $rg $locationOverride
$server2 = Create-ServerForTest $rg $locationOverride
try
{
$linkName = Get-Elasti... |
combined_dataset/train/non-malicious/sample_65_65.ps1 | sample_65_65.ps1 | ##########################################################################
# DELL PROPRIETARY INFORMATION
#
# This software is confidential. Dell Inc., or one of its subsidiaries, has supplied this
# software to you under the terms of a license agreement,nondisclosure agreement or both.
# You may not copy, disclose, o... |
combined_dataset/train/non-malicious/2414.ps1 | 2414.ps1 |
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]$Name,
[Parameter(Mandatory)]
[string]$Manufacturer,
[Parameter(Mandatory)]
[ValidatePattern('[-+]?([0-9]*\.[0-9]+|[0-9]+)')]
[string]$SoftwareVersion,
[Parameter()]
[string]$Owner = 'Adam Bertram',
[Parameter()]
[string]$SupportContact = 'Adam Bertra... |
combined_dataset/train/non-malicious/sample_38_12.ps1 | sample_38_12.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 = '82.0.0'
# Supported PSEdi... |
combined_dataset/train/non-malicious/Connect-AccessDB_1.ps1 | Connect-AccessDB_1.ps1 | # Functions for connecting to and working with Access databases
# Matt Wilson
# May 2009
function Connect-AccessDB ($global:dbFilePath) {
# Test to ensure valid path to database file was supplied
if (-not (Test-Path $dbFilePath)) {
Write-Error "Invalid Access database path specified. Please supply full a... |
combined_dataset/train/non-malicious/2968.ps1 | 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... |
combined_dataset/train/non-malicious/sample_24_98.ps1 | sample_24_98.ps1 |
$MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent
. "$MyPath\mesa_init_msvc.ps1"
# we want more secure TLS 1.2 for most things, but it breaks SourceForge
# downloads so must be done after Chocolatey use
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtoco... |
combined_dataset/train/non-malicious/sample_4_27.ps1 | sample_4_27.ps1 | ConvertFrom-StringData @'
id_sql_setup_collect_bootstrap_logs=Collecting SQL Setup Bootstrap Logs
id_sql_setup_collect_2005_logs=Collecting SQL 2005 Bootstrap Logs
id_sql_setup_collect_2008_2008r2_logs=Collecting SQL 2008 and 2008R2 Bootstrap Logs
id_sql_setup_collect_2012_logs=Collecting SQL 2012 Bootstrap Logs
i... |
combined_dataset/train/non-malicious/sample_49_61.ps1 | sample_49_61.ps1 | #
# Module manifest for module 'OCI.PSModules.Tenantmanagercontrolplane'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Tenantmanagercontrolplane.dll'
# Version number of this module.
ModuleVersion = '81... |
combined_dataset/train/non-malicious/2841.ps1 | 2841.ps1 |
function ResolveError
{
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline=$true)]
$ErrorRecord=$Error[0],
[Switch]
$Short
)
process {
if ($_ -eq $null) { $_ = $ErrorRecord }
$ex = $_.Exception
if (-not $Short) {
$error_message =... |
combined_dataset/train/non-malicious/sample_14_77.ps1 | sample_14_77.ps1 | ConvertFrom-StringData @'
id_clustercsvd=Cluster Shared Volume information
id_clustercsvdesc=Obtaining information about Cluster Shared Volumes
'@
# SIG # Begin signature block
# MIIoPAYJKoZIhvcNAQcCoIIoLTCCKCkCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
... |
combined_dataset/train/non-malicious/989.ps1 | 989.ps1 | class MigrationLogger {
[string]$CurrentCommandPath
[string]$OutputFilePath
[string]$ScriptName
[DateTime]$StartDate
MigrationLogger([string] $CurrentCommandPath) {
$this.StartDate = Get-Date
$this.CurrentCommandPath = $CurrentCommandPath
$this.ScriptName = Split-Path $Curr... |
combined_dataset/train/non-malicious/3191.ps1 | 3191.ps1 | Function ConvertTo-FlatObject {
[cmdletbinding()]
param(
[parameter( Mandatory = $True,
ValueFromPipeline = $True)]
[PSObject[]]$InputObject,
[string[]]$Exclude = "",
[bool]$ExcludeDefault = $True,
[string[]]$Include = $null,
[string[... |
combined_dataset/train/non-malicious/sample_40_83.ps1 | sample_40_83.ps1 | #
# Module manifest for module 'OCI.PSModules.Redis'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Redis.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/running regions in ISE.ps1 | running regions in ISE.ps1 | function invoke-caretline
{
invoke-expression $([Regex]::Split($psISE.CurrentOpenedFile.Editor.text,"`r`n" )[$psISE.CurrentOpenedFile.Editor.caretline-1])
}
$psISE.CustomMenu.Submenus.Add("Run single line", {invoke-caretline} , 'f7')
function invoke-region([int] $num)
{
$ed = $psISE.CurrentOpenedFile.Editor
$l... |
combined_dataset/train/non-malicious/Clear-XCAttributes.ps1 | Clear-XCAttributes.ps1 | param(
[Parameter(Position=0,ValueFromPipeline=$True)]
[ValidateNotNullorEmpty()] $User,
[switch]$ClearXCAttributes
)
begin{
$Global:LegacyXCUsers = @()
# attributes to be nulled according to:
# http://blogs.technet.com/b/exchange/archive/2006/10/13/3395089.aspx
$XCattributes=@(
"adminDisplayName","altRecip... |
combined_dataset/train/non-malicious/sample_37_10.ps1 | sample_37_10.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... |
combined_dataset/train/non-malicious/get-uuid_allHVs_1.ps1 | get-uuid_allHVs_1.ps1 | #The PowerShell Talk
#Building a HyperVisor Independent Script
#
#This script will take a VM (or host) object from the pipline,
#and from that determine if you're connected to XenServer
#or VMware, and return the apropriate UUID.
Begin {
#VMware VM Host (ESX) UUID
$VMHost_UUID = @{
Name = "VMHo... |
combined_dataset/train/non-malicious/Get-WMIVersions_1.ps1 | Get-WMIVersions_1.ps1 | #Requires -Version 2
param ( $Credential, $ComputerName )
# The official way to detect .NET versions is to look at their known location on the hard drive as per
# this article: http://msdn.microsoft.com/en-us/kb/kb00318785.aspx
# thanks to David M (http://twitter.com/makovec) for the WQL
$query = "select name... |
combined_dataset/train/non-malicious/843.ps1 | 843.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 ProcessItemImpl($processor, $cs... |
combined_dataset/train/non-malicious/sample_49_27.ps1 | sample_49_27.ps1 | #
# Module manifest for module 'OCI.PSModules.Aianomalydetection'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Aianomalydetection.dll'
# Version number of this module.
ModuleVersion = '83.1.0'
# Suppo... |
combined_dataset/train/non-malicious/Send-HTMLFormattedEmail_2.ps1 | Send-HTMLFormattedEmail_2.ps1 | ##################################################
# cmdlets
##################################################
#-------------------------------------------------
# Send-HTMLFormattedEmail
#-------------------------------------------------
# Usage: Send-HTMLFormattedEmail -?
#------------------------------------... |
combined_dataset/train/non-malicious/WinFirewall-Disabled.ps1 | WinFirewall-Disabled.ps1 | function WinFirewall-Disabled(){
param (
$computer
)
c:\\PsTools\\PsExec.exe \\\\"$computer" sc config sharedaccess start= disabled
}
|
combined_dataset/train/non-malicious/3599.ps1 | 3599.ps1 |
function Get-AzureRmSecurityPricing-SubscriptionScope
{
$pricings = Get-AzSecurityPricing
Validate-Pricings $pricings
}
function Get-AzureRmSecurityPricing-SubscriptionLevelResource
{
$pricings = Get-AzSecurityPricing -Name "VirtualMachines"
Validate-Pricings $pricings
}
function Get-AzureR... |
combined_dataset/train/non-malicious/3236.ps1 | 3236.ps1 |
class LogMessage {
[datetime]$DateTime = (Get-Date).ToUniversalTime()
[string]$Class
[string]$Method
[LogSeverity]$Severity = [LogSeverity]::Normal
[LogLevel]$LogLevel = [LogLevel]::Info
[string]$Message
[object]$Data
LogMessage() {
}
LogMessage([string]$Message) {
$th... |
combined_dataset/train/non-malicious/sample_67_40.ps1 | sample_67_40.ps1 | #
# Module manifest for module 'OCI.PSModules.Email'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Email.dll'
# Version number of this module.
ModuleVersion = '90.0.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/2190.ps1 | 2190.ps1 | param(
[parameter(Mandatory=$true)]
$IPRangeOld,
[parameter(Mandatory=$true)]
$IPRangeNew
)
Begin {
$ReferenceObject = $IPRangeOld.Split(",")
$ReferenceObjectCount = [System.Math]::Round(($ReferenceObject | Measure-Object).Count / 2)
$DifferenceObject = $IPRangeNew.Split(",")
$DifferenceObjectCount = [S... |
combined_dataset/train/non-malicious/sample_7_38.ps1 | sample_7_38.ps1 | #************************************************
# DC_RDSRDWeb.ps1
# Version 1.0.1
# Date: 21-01-2012
# Author: Daniel Grund - dgrund@microsoft.com
# Description:
# This script gets the IIS config
# 1.0.0 Beta release
# 1.0.1 Release
# TODO get windows\web\rdweb dir
#****************************************... |
combined_dataset/train/non-malicious/sample_8_70.ps1 | sample_8_70.ps1 | ###########################################################################
# DC_Get-Network
# Version 1.0
# Date: 09-26-2012
# Author: mifannin
# Description: Creates Autotuning.txt, Firewall.txt, Netsh.txt, Winsock.txt,
# Bitsadmin.txt, WPAD & PAC File Collection
##############################################... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.