full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/sample_0_92.ps1 | sample_0_92.ps1 | #************************************************
# TS_2K3PoolUsageMaximum.ps1
# Version 1.0.1
# Date: 5/8/2012
# Author: v-kaw
# Description: [Idea ID 2446] [Windows] Determining the trimming threshold set by the Memory Manager
# Rule number: 2446
# Rule URL: //sharepoint/sites/rules/Rule%20Submissions/Forms... |
combined_dataset/train/non-malicious/sample_24_84.ps1 | sample_24_84.ps1 | <#
.SYNOPSIS
Adds whatever IPAddress you want to a remote sessions Hosts file
.PARAMETER Session
Passed in Remote session object that can be generated from Local-Create-Remote-Session.ps1
.PARAMETER IPAddress
Any specific IP Address you want to use, for this particular script, we generally use it for 127.... |
combined_dataset/train/non-malicious/sample_9_14.ps1 | sample_9_14.ps1 | #************************************************
# DC_WINSClient-Component.ps1
# Version 1.0
# Date: 2009-2014
# Author: Boyd Benson (bbenson@microsoft.com)
# Description: Collects information about WINS Client.
# Called from: Main Networking Diag
#*******************************************************
Trap... |
combined_dataset/train/non-malicious/sample_18_4.ps1 | sample_18_4.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)
... |
combined_dataset/train/non-malicious/1824.ps1 | 1824.ps1 |
Describe "Set-Item" -Tag "CI" {
$testCases = @{ Path = "variable:SetItemTestCase"; Value = "TestData"; Validate = { $SetItemTestCase | Should -Be "TestData" }; Reset = {remove-item variable:SetItemTestCase} },
@{ Path = "alias:SetItemTestCase"; Value = "Get-Alias"; Validate = { (Get-Alias SetItemTestCase)... |
combined_dataset/train/non-malicious/4019.ps1 | 4019.ps1 |
function Test-RaClassicAdmins
{
$subscription = $(Get-AzContext).Subscription
$classic = Get-AzRoleAssignment -IncludeClassicAdministrators | Where-Object { $_.Scope -ieq ('/subscriptions/' + $subscription[0].Id) -and $_.RoleDefinitionName -ieq 'ServiceAdministrator;AccountAdministra... |
combined_dataset/train/non-malicious/Multiple strings params.ps1 | Multiple strings params.ps1 | # For example I have this function
function copySourceDestination {
Param (
[string]$sourceFile,
[string]$destinationPath
)
# Strangely enough $sourceFile will contain both the values of $sourceFile and $destinationPath
# in this case $destinationPath will be empty and $sourceFile will show up as: "C:... |
combined_dataset/train/non-malicious/1289.ps1 | 1289.ps1 |
function Get-CMsmqMessageQueue
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]
$Name,
[Switch]
$Private
)
Set-StrictMode -Version 'Latest'
Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.S... |
combined_dataset/train/non-malicious/839.ps1 | 839.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_43_70.ps1 | sample_43_70.ps1 | function Disable-WACSIInsightsCapability {
<#
.SYNOPSIS
Deactivates a capability, which stops data collection for that capability and prevents the capability from being invoked.
.DESCRIPTION
Deactivates a capability, which stops data collection for that capability and prevents the capability from being invoked... |
combined_dataset/train/non-malicious/sample_32_8.ps1 | sample_32_8.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
<#
.SYNOPSIS
Starts the language and debug services from the PowerShellEditorServices module.
.DESCRIPTION
PowerShell Editor Services Bootstrapper Script
----------------------------------------------
This script contains... |
combined_dataset/train/non-malicious/Script-Proc.sql.ps1 | Script-Proc.sql.ps1 | param(
[string] $ProcedureName,
[string] $Path = "$($ProcedureName).sql",
[string] $ConnectionString = 'Data Source=.\\sqlexpress;Initial Catalog=master;Integrated Security=SSPI;'
);
try {
[System.Data.SqlClient.SqlConnection] $cn = New-Object System.Data.SqlClient.SqlConnection (,$ConnectionStr... |
combined_dataset/train/non-malicious/2516.ps1 | 2516.ps1 |
$users = "mmessano@primealliancesolutions.com"
$fromemail = "DataManagement@primealliancesolutions.com"
$server = "outbound.smtp.dexma.com"
$list = "C:\Users\MMessano\Desktop\Payload_QA.txt"
$computers = get-content $list
[decimal]$thresholdspace = 60
$tableFragment = Get-WMIObject -ComputerName $c... |
combined_dataset/train/non-malicious/2115.ps1 | 2115.ps1 |
Describe "Tests for hashtable to PSCustomObject conversion" -Tags "CI" {
BeforeAll {
class SampleClass5 {
[int]$a
[int]$b
SampleClass5([int]$x) { $this.a = $x }
SampleClass5([hashtable]$h) { $this.a = 100; $this.b = 100 }
}
}
$testdata = @(
... |
combined_dataset/train/non-malicious/sample_20_52.ps1 | sample_20_52.ps1 | #
# Module manifest for module 'OCI.PSModules.Dataflow'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Dataflow.dll'
# Version number of this module.
ModuleVersion = '74.1.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/sample_57_65.ps1 | sample_57_65.ps1 | #
# Module manifest for module 'OCI.PSModules.Waf'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Waf.dll'
# Version number of this module.
ModuleVersion = '86.0.0'
# Supported PSEditions
CompatiblePSEd... |
combined_dataset/train/non-malicious/sample_56_86.ps1 | sample_56_86.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 = '83.1.0'
#... |
combined_dataset/train/non-malicious/ImaginaryFriendFeed.ps1 | ImaginaryFriendFeed.ps1 | function New-ImaginaryFriend {
##.Note
## DEPENDS on the WatiN module in http`://poshcode.org/1108
##.Synopsis
## Creates a new "Imaginary Friend" on friendfeed by automating your browser
##.Example
## New-ImaginaryFriend PoshCode @{Twitter="PoshCode"} http`://poshcode.org/PoshCode.png
##
[CmdletBindin... |
combined_dataset/train/non-malicious/144.ps1 | 144.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/sample_12_55.ps1 | sample_12_55.ps1 | #
# Module manifest for module 'PowerShellEditorServices'
#
# Generated by: daviwil
#
# Generated on: 5/12/2016
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'PowerShellEditorServices.Commands.psm1'
# Version number of this module.
ModuleVersion = '0.2.0'
# I... |
combined_dataset/train/non-malicious/sample_44_31.ps1 | sample_44_31.ps1 | # Variables
$name = "Alice"
$age = 25
# Arrays
$numbers = 1, 2, 3, 4, 5
# Hash table
$person = @{
Name = "Bob"
Age = 30
}
# Conditional statement
if ($age -lt 30) {
Write-Host "$name is young."
} else {
Write-Host "$name is not so young."
}
# Looping through an array
foreach ($number in $numbers) {
Write... |
combined_dataset/train/non-malicious/2459.ps1 | 2459.ps1 | function Show-Menu
{
param (
[string]$Title = 'My Menu'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Press '1' for this option."
Write-Host "2: Press '2' for this option."
Write-Host "3: Press '3' for this option."
Write-Host "Q: Press 'Q' to quit."
}
do
{
Show-Menu
$... |
combined_dataset/train/non-malicious/Get-WebFile _2.6.ps1 | Get-WebFile _2.6.ps1 | ## Get-WebFile (aka wget for PowerShell)
##############################################################################################################
## Downloads a file or page from the web
## History:
## v3.7 - Added Credentials parameter for passing credentials via System.Net.NetworkCredential
## v3.6 - Add -... |
combined_dataset/train/non-malicious/sample_11_93.ps1 | sample_11_93.ps1 | #Requires -RunAsAdministrator
##------------------------------------------------------------------
## <copyright file="Uninstall-ObservabilityExtension.ps1" company="Microsoft">
## Copyright (C) Microsoft. All rights reserved.
## </copyright>
##---------------------------------------------------------------... |
combined_dataset/train/non-malicious/sample_11_72.ps1 | sample_11_72.ps1 | param()
if (Get-Module posh-vcpkg) { return }
if ($PSVersionTable.PSVersion.Major -lt 5) {
Write-Warning ("posh-vcpkg does not support PowerShell versions before 5.0.")
return
}
if (Test-Path Function:\TabExpansion) {
Rename-Item Function:\TabExpansion VcpkgTabExpansionBackup
}
function Tab... |
combined_dataset/train/non-malicious/sample_36_87.ps1 | sample_36_87.ps1 | #
# Copyright (c) Microsoft Corporation.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ... |
combined_dataset/train/non-malicious/Logging AD logins.ps1 | Logging AD logins.ps1 | #* FileName: loginTime.ps1
#*=============================================================================
#* Created: [09/25/2009]
#* Author: Alan Oakland
#*=============================================================================
#* Purpose: Create a log of login times.
#*===================================... |
combined_dataset/train/non-malicious/sample_43_43.ps1 | sample_43_43.ps1 | #
# Module manifest for module 'OCI.PSModules.Fusionapps'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Fusionapps.dll'
# Version number of this module.
ModuleVersion = '75.1.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/finddupe_4.ps1 | finddupe_4.ps1 | function Get-MD5([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]'))
{
$stream = $null;
$cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider];
$hashAlgorithm = new-object $cryptoServiceProvider
$stream = $file.OpenRead();
$hashByteArray = $hashA... |
combined_dataset/train/non-malicious/sample_29_54.ps1 | sample_29_54.ps1 | ConvertFrom-StringData @'
EnvironmentErrorAlreadyExists=Det finns redan en miljövariabel med det här namnet och av den här typen.
EnvironmentErrorDoesNotExists=Det finns ingen miljövariabel med det här namnet och av den här typen.
'@
# SIG # Begin signature block
# MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkg... |
combined_dataset/train/non-malicious/remove-ADobject.ps1 | remove-ADobject.ps1 | ######################################################
# Script to remove unauthorized objects from AD group
# (c) Josh Coen
# Requires AD cmdlets
######################################################
# set path and file name in $strFile
# file should contain authorized usernames or groups one on each line
# ... |
combined_dataset/train/non-malicious/Start-Presentation_2.ps1 | Start-Presentation_2.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/2209.ps1 | 2209.ps1 |
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[parameter(Mandatory=$true, HelpMessage="Site server where the SMS Provider is installed")]
[ValidateNotNullOrEmpty()]
[ValidateScript({Test-Connection -ComputerName $_ -Count 1 -Quiet})]
[string]$SiteServer,
[parameter(Mandatory=$true, HelpMessag... |
combined_dataset/train/non-malicious/Newer-LinkedClone.ps1 | Newer-LinkedClone.ps1 | #Requires -version 2
# TITLE: Newer-LinkedClone.ps1
# AUTHOR: Cameron Smith (original by Hal Rottenberg)
# Adapted from a technique published originally by Keshav Attrey http://www.vmdev.info/?p=40
# Also see William Lam's Perl script: http://engineering.ucsb.edu/~duonglt/vmware/vGhettoLinkedClone.html
# And Le... |
combined_dataset/train/non-malicious/The PowerShell Talk Demo.ps1 | The PowerShell Talk Demo.ps1 | #The PowerShell Takl
#Demo 1 - Hypervisors
#ESX
#Connect to vCenter
Get-Credential | connect-viserver -Server "Your vCenter Address"
#Create Our Network
Get-VMHost "ESXServerName" | New-VirtualSwitch -Name "Test" -NumPorts 64
#And a Port Group on that network
Get-VMHost "ESXServerName" | get-virtualswitch... |
combined_dataset/train/non-malicious/sample_0_26.ps1 | sample_0_26.ps1 | ConvertFrom-StringData @'
id_dfsrcheckrc=Check for DFSR issues
id_dfsrcheckpaused=Detect if DFSR is currently paused due to dirty shutdown.
id_dfsrcheckpausedinfo=DFSR on the SysVol disk may be paused. Time of detected 2213 event:
id_dfsrcheckpausedsd=DFSR may be in a paused state when an Event ID 2213 is logged ... |
combined_dataset/train/non-malicious/sample_51_10.ps1 | sample_51_10.ps1 | param($installPath, $toolsPath, $package, $project)
Import-Module (Join-Path $toolsPath common.psm1) -Force
try {
# Indicates if current project is a VB project
$IsVbProject = ($project.CodeModel.Language -eq [EnvDTE.CodeModelLanguageConstants]::vsCMLanguageVB)
if ($IsVbProject) {
... |
combined_dataset/train/non-malicious/sample_60_72.ps1 | sample_60_72.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 = '87.0.0'
# Supported... |
combined_dataset/train/non-malicious/sample_35_85.ps1 | sample_35_85.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 = '79.0.0'
# Supported PSE... |
combined_dataset/train/non-malicious/sample_0_45.ps1 | sample_0_45.ps1 | /* ---------------------------------------------------------------------------
* DCIM_SMCLPADSystemComponent
* ---------------------------------------------------------------------------
*/
[ dynamic, provider("dcismprovider"),
Association,
Description ("It is used to aggregate CIM_ComputerSystem inst... |
combined_dataset/train/non-malicious/sample_29_14.ps1 | sample_29_14.ps1 | # make sure we stop on exceptions
$ErrorActionPreference = "Stop"
# This object reprents the result value for tab expansion functions when no result is returned.
# This is so that we can distinguish it from $null, which has different semantics
$NoResultValue = New-Object PSObject -Property @{ NoResult = $true }
... |
combined_dataset/train/non-malicious/sample_9_88.ps1 | sample_9_88.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... |
combined_dataset/train/non-malicious/sample_22_5.ps1 | sample_22_5.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function Join-ScriptExtent {
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
[CmdletBinding()]
[OutputType([System.Management.Automation.Language.IScriptExtent])]
param(
[Parameter(Value... |
combined_dataset/train/non-malicious/2060.ps1 | 2060.ps1 |
Describe "Experimental Feature Basic Tests - Feature-Disabled" -tags "CI" {
BeforeAll {
$skipTest = $EnabledExperimentalFeatures.Contains('ExpTest.FeatureOne')
if ($skipTest) {
Write-Verbose "Test Suite Skipped. The test suite requires the experimental feature 'ExpTest.FeatureOne' t... |
combined_dataset/train/non-malicious/sample_12_63.ps1 | sample_12_63.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... |
combined_dataset/train/non-malicious/sample_55_66.ps1 | sample_55_66.ps1 | # SharePoint references that need to remove when uninstall
$ReferencesToRemoveWhenUninstall = @(
@("Microsoft.SharePoint.Client"),
@("Microsoft.SharePoint.Client.Runtime"),
@("System.IdentityModel.Tokens.Jwt"),
@("Microsoft.IdentityModel.Tokens")
)
# SharePoint references that need to be copy l... |
combined_dataset/train/non-malicious/3845.ps1 | 3845.ps1 |
function GetResourceGroupName
{
$stack = Get-PSCallStack
$testName = $null;
foreach ($frame in $stack)
{
if ($frame.Command.StartsWith("Test-", "CurrentCultureIgnoreCase"))
{
$testName = $frame.Command;
}
}
$oldErrorActionPreferenceValue = $ErrorActionPreference;
$ErrorAc... |
combined_dataset/train/non-malicious/IADsDNWithBinary Cmdlet.ps1 | IADsDNWithBinary Cmdlet.ps1 | @@//Adapted from code @ http://mow001.blogspot.com/2006/01/msh-snap-in-to-translate.html Thanks!
using System;
using System.ComponentModel;
using System.Management.Automation;
using System.Reflection;
using System.Diagnostics;
namespace space
{
// This class defines the properties of a snap-in
[... |
combined_dataset/train/non-malicious/sample_53_50.ps1 | sample_53_50.ps1 | #
# Module manifest for module 'OCI.PSModules.Marketplacepublisher'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Marketplacepublisher.dll'
# Version number of this module.
ModuleVersion = '82.0.0'
# S... |
combined_dataset/train/non-malicious/Create-Mdb.ps1 | Create-Mdb.ps1 | # Copyright (c) 2011 Justin Dearing <zippy1981@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... |
combined_dataset/train/non-malicious/get attach. from Lotus.ps1 | get attach. from Lotus.ps1 | Param (
[Parameter(ValueFromPipelineByPropertyName=$True,
HelpMessage='Lotus Domino Server')]
$ServerName,
[Parameter(ValueFromPipelineByPropertyName=$True,
HelpMessage='Lotus Mail Database')]
$Database,
[Parameter(ValueFromPipelineByPropertyName=$True,
HelpMessage='View to Select')]
$View,
[P... |
combined_dataset/train/non-malicious/sample_15_64.ps1 | sample_15_64.ps1 | #
# Module manifest for module 'Microsoft.SME.Monitor'
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'Microsoft.SME.Monitor.psm1'
# Version number of this module.
ModuleVersion = '4.11.0'
# Supported PSEditions
# CompatiblePSEditions = @()
# ID used to unique... |
combined_dataset/train/non-malicious/sample_4_24.ps1 | sample_4_24.ps1 | #************************************************
# TS_SurfaceDetectFirmwareVersions.ps1
# Description: SurfaceDetectFirmwareVersions
#
# Rule GUID: 34F6567E-7B92-4C37-B1CA-5DE6E66D4881
#
# Files:
# TS_SurfaceDetectFirmwareVersions.ps1
# RC_SurfaceDetectFirmwareVersions.xml
# Include.xml
#
# Output files:
#... |
combined_dataset/train/non-malicious/sample_40_65.ps1 | sample_40_65.ps1 | ConvertFrom-StringData @'
###PSLOC
ElevationModeInfo = Powershell running as Administrator. Continuing........
ElevationModeMsg = Running as administrator is required for this operation.Please restart PowerShell as Administrator and retry.
ElevationModeErrMsg = This operation requires elevation.
PsSessionFail = Un... |
combined_dataset/train/non-malicious/New-XVM.ps1 | New-XVM.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)" ... |
combined_dataset/train/non-malicious/1558.ps1 | 1558.ps1 | function Get-MrEsetUpdateVersion {
[CmdletBinding()]
param (
[ValidateNotNullOrEmpty()]
[string[]]$ComputerName = $env:COMPUTERNAME,
[System.Management.Automation.Credential()]$Credential = [System.Management.Automation.PSCredential]::Empty
)
$Params = @{}
if ($PSBo... |
combined_dataset/train/non-malicious/sample_21_11.ps1 | sample_21_11.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
<#
.Synopsis
Registers or unregisters the PowerShell ETW manifest
.Parameter Path
The fully qualified path to the PowerShell.Core.Instrumentation.man manifest file.
The default value is the location of this script.
.Paramet... |
combined_dataset/train/non-malicious/783.ps1 | 783.ps1 |
function Import-EditorCommand {
[OutputType([Microsoft.PowerShell.EditorServices.Services.PowerShellContext.EditorCommand])]
[CmdletBinding(DefaultParameterSetName='ByCommand')]
param(
[Parameter(Position=0,
Mandatory,
ValueFromPipeline,
... |
combined_dataset/train/non-malicious/sample_48_19.ps1 | sample_48_19.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 = '75.1.0'
#... |
combined_dataset/train/non-malicious/Get-FreeDiskSpace.ps1 | Get-FreeDiskSpace.ps1 | <#
.SYNOPSIS
Return free space on disk
.DESCRIPTION
This script works in conjunction with an Event Trigger on the System
event on our file servers. This script queries the System log for
EventID 2013, and returns the drive letter from the most recent
event.
... |
combined_dataset/train/non-malicious/3292.ps1 | 3292.ps1 | enum DiscordMsgSendType {
WebRequest
RestMethod
}
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Scope='Class', Target='*')]
class DiscordBackend : Backend {
[string]$BaseUrl = 'https://discordapp.com/api'
[string]$GuildId
hidden [hashtab... |
combined_dataset/train/non-malicious/2454.ps1 | 2454.ps1 |
[CmdletBinding()]
param (
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
ValueFromPipelineByPropertyName = $True)]
[string]$Computername,
[Parameter(Mandatory = $False,
ValueFromPipeline = $False,
ValueFromPipelineByPropertyName = $False)]
[string]$PsExecPath = 'C:\PsExec.exe'
)
... |
combined_dataset/train/non-malicious/3256.ps1 | 3256.ps1 |
class CommandExecutionContext {
[string]$Id = (New-Guid).ToString().Split('-')[0]
[bool]$Complete = $false
[CommandResult]$Result
[string]$FullyQualifiedCommandName
[Command]$Command
[ParsedCommand]$ParsedCommand
[Message]$Message
[bool]$IsJob
[datetime]$Started
[datetime]$Ende... |
combined_dataset/train/non-malicious/POC csharp expressions.ps1 | POC csharp expressions.ps1 | function run-csharpexpression([string] $expression )
{
$local:name = [system.guid]::NewGuid().tostring().replace('-','_').insert(0,"csharpexpr")
$local:template = @"
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace ShellTools.DynamicCsharpExpression
{
public ... |
combined_dataset/train/non-malicious/powertab patch_1.ps1 | powertab patch_1.ps1 | # Stick this anywhere
filter convertTypeToTabCompletionName()
{
$typeToTabCompletion=@{
[Microsoft.Powershell.Commands.X509StoreLocation]={$_.Location};
[System.Security.Cryptography.X509Certificates.X509Store]={$_.Name};
[Microsoft.Win32.RegistryKey]={ $_.Name.Split("\\"... |
combined_dataset/train/non-malicious/h20 -Hashtables 2 object.ps1 | 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)
{
... |
combined_dataset/train/non-malicious/sample_59_56.ps1 | sample_59_56.ps1 | .$psScriptRoot\Set-Dell1stBootdevice.ps1
.$psScriptRoot\Get-DellBiosSettings.ps1
.$psScriptRoot\Clear-DellAdminPassword.ps1
.$psScriptRoot\Set-DellAutoOnForSelectDays.ps1
# SIG # Begin signature block
# MIIqwQYJKoZIhvcNAQcCoIIqsjCCKq4CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAA... |
combined_dataset/train/non-malicious/4393.ps1 | 4393.ps1 | function New-PSGetItemInfo
{
param
(
[Parameter(Mandatory=$true)]
$SoftwareIdentity,
[Parameter()]
$PackageManagementProviderName,
[Parameter()]
[string]
$SourceLocation,
[Parameter(Mandatory=$true)]
[string]
$Type,
[Par... |
combined_dataset/train/non-malicious/2335.ps1 | 2335.ps1 |
function Get-UnlinkedGpo
{
[OutputType([pscustomobject])]
[CmdletBinding()]
param()
begin
{
$ErrorActionPreference = 'Stop'
}
process
{
try
{
$gpoReport = [xml](Get-GPOReport -All -ReportType XML)
@($gpoReport.GPOs.GPO).where({ -not $_.LinksTo }).foreach({
[pscustomobject]@{ Name = $_.Name ... |
combined_dataset/train/non-malicious/sample_47_45.ps1 | sample_47_45.ps1 | ConvertFrom-StringData @'
FailoverClustersModuleRequired=De vereiste PowerShell-module (FailoverClusters) is niet gevonden. Gebruik het hulpprogramma Functies en onderdelen om het volgende te installeren: Remote Server Administration Tools | Beheerprogramma's voor onderdelen | Hulpprogramma's voor failoverclustering |... |
combined_dataset/train/non-malicious/3570.ps1 | 3570.ps1 |
function Test-AnalysisServicesServer
{
try
{
$location = Get-AnalysisServicesLocation
$resourceGroupName = Get-ResourceGroupName
$serverName = Get-AnalysisServicesServerName
$backupBlobContainerUri = $env:AAS_DEFAULT_BACKUP_BLOB_CONTAINER_URI
New-AzResourceGroup -Name $resourceGroupName -Location $lo... |
combined_dataset/train/non-malicious/4461.ps1 | 4461.ps1 |
Uninstall-PSResource 'TestModule'
Uninstall-PSResource -name 'TestModule'
Uninstall-PSResource 'TestModule1', 'TestModule2', 'TestModule3'
Uninstall-PSResource 'TestModule' -MinimumVersion '1.5.0'
Uninstall-PSResource 'TestModule' -MaximumVersion '1.5.0'
Uninstall-PSResource 'TestModule' -MinimumVersion... |
combined_dataset/train/non-malicious/PresentationFrame.xaml.ps1 | PresentationFrame.xaml.ps1 | <ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
<!-- Resource dictionary entries should be defined here. -->
... |
combined_dataset/train/non-malicious/Experimental.IO 2.0.ps1 | Experimental.IO 2.0.ps1 | ## Requires the Experimental.IO "LongPath" library from the BCL team: http://bcl.codeplex.com/
## Compile it against .Net 3.5 (for PowerShell's sake) and place it the module folder with this psm1
if(!("Microsoft.Experimental.IO.LongPathDirectory" -as [type])) {
Add-Type -Path $PSScriptRoot\\Microsoft.Experimental... |
combined_dataset/train/non-malicious/4105.ps1 | 4105.ps1 |
[CmdletBinding()]
param
(
[string]$ConsoleTitle = 'NIC Advanced Properties',
[ValidateSet('Off', 'On')][string]$EnergyEfficientEthernet,
[ValidateSet('Disabled', 'Tx Enabled', 'Rx Enabled', 'Rx & Tx Enabled')][string]$FlowControl,
[ValidateSet('Disabled', '4088 Bytes', '9014 Bytes')][string]$JumboPacket,
[Va... |
combined_dataset/train/non-malicious/sample_2_89.ps1 | sample_2_89.ps1 | ConvertFrom-StringData @'
id_2k3clsiduseraclcheck_st=Permissions for local Users group was removed from registry key HKCR\\CLSID
'@
# SIG # Begin signature block
# MIIoVAYJKoZIhvcNAQcCoIIoRTCCKEECAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAA... |
combined_dataset/train/non-malicious/1189.ps1 | 1189.ps1 |
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve)
Describe 'Get-ComPermission' {
It 'should get com access permissions' {
$rules = Get-ComPermission -Access -Default
$rules | Should -Not -BeNullOrEmpty
$rules.Count | Should -BeGreaterThan 1
... |
combined_dataset/train/non-malicious/618.ps1 | 618.ps1 | param(
[string]$Version,
[string]$Path,
[switch]$Force,
$Update,
[switch]$Uninstall
)
$Configs = @{
Url = "http://dlc.sun.com.edgesuite.net/virtualbox/4.3.14/VirtualBox-4.3.14-95030-Win.exe"
Path = "$(Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)\"
Executable = "C:\Program Files (x86)\... |
combined_dataset/train/non-malicious/19.ps1 | 19.ps1 | $modulePath = Convert-Path $PSScriptRoot\..\src
$moduleManifestPath = "$modulePath\posh-git.psd1"
$csi = [char]0x1b + "["
if (!(Get-Variable -Name gitbin -Scope global -ErrorAction SilentlyContinue)) {
if (($PSVersionTable.PSVersion.Major -le 5) -or $IsWindows) {
$global:gitbin = Get-Command -Nam... |
combined_dataset/train/non-malicious/1249.ps1 | 1249.ps1 |
function Remove-CJunction
{
[CmdletBinding(SupportsShouldProcess=$true,DefaultParameterSetName='Path')]
param(
[Parameter(Mandatory=$true,Position=0,ParameterSetName='Path')]
[string]
$Path,
[Parameter(Mandatory=$true,ParameterSetName='LiteralPat... |
combined_dataset/train/non-malicious/sample_36_89.ps1 | sample_36_89.ps1 | # ---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------------------------... |
combined_dataset/train/non-malicious/4464.ps1 | 4464.ps1 |
function Find-PSResource {
[OutputType([PSCustomObject[]])]
[Cmdletbinding(SupportsShouldProcess = $true)]
Param
(
[Parameter(ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
Position = 0)]
[ValidateNotNullOrEmpty()]
... |
combined_dataset/train/non-malicious/Get-Tree.ps1 | Get-Tree.ps1 | #.Synopsis
# Creates a fir tree in your console!
#.Description
# A simple christmas tree simulation with (optional) flashing lights.
# Requires your font be set to a True Type font (best results with Consolas).
#.Parameter Trim
# Whether or not to trim the tree. NOTE: In violation of convention, this switch ... |
combined_dataset/train/non-malicious/sample_66_39.ps1 | sample_66_39.ps1 | import{V as s}from"./index-BOHbg3sL.js";/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.47.0(69991d66135e4a1fc1cf0b1ac4ad25d429866a0d)
* Released under the MIT license
* https://github.com/microsoft/monaco-edit... |
combined_dataset/train/non-malicious/2025.ps1 | 2025.ps1 |
Describe "New-PSSessionOption parameters for non-Windows platforms" -Tag "CI" {
BeforeAll {
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
if ($IsWindows) {
$PSDefaultParameterValues['it:skip'] = $true
}
}
AfterAll {
$global:PSDefau... |
combined_dataset/train/non-malicious/Get-McAfeeInfo.ps1 | Get-McAfeeInfo.ps1 | #------------------------------------------------------------------
# Produces report for McAfee AntiVirus on a set of remote computers
# Usage: get-content <list of servers.txt> | .\\GetMcAfeeInfo.ps1
# Optionally pipe output to Export-Csv, ConverTo-Html
#----------------------------------------------------... |
combined_dataset/train/non-malicious/1862.ps1 | 1862.ps1 |
Describe "Import-Module" -Tags "CI" {
$moduleName = "Microsoft.PowerShell.Security"
BeforeAll {
$originalPSModulePath = $env:PSModulePath
New-Item -ItemType Directory -Path "$testdrive\Modules\TestModule\1.1" -Force > $null
New-Item -ItemType Directory -Path "$testdrive\Modules\TestMod... |
combined_dataset/train/non-malicious/sample_58_16.ps1 | sample_58_16.ps1 | #
# Module manifest for module 'OCI.PSModules.Fusionapps'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Fusionapps.dll'
# Version number of this module.
ModuleVersion = '86.0.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/sample_35_24.ps1 | sample_35_24.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function ConvertFrom-ScriptExtent {
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
[CmdletBinding()]
[OutputType([Microsoft.PowerShell.EditorServices.Extensions.IFileRange, Microsoft.PowerShell.Edito... |
combined_dataset/train/non-malicious/Get-InstalledProgram_v2.ps1 | Get-InstalledProgram_v2.ps1 | function Get-InstalledProgram() {
param (
[String[]]$Computer = "n2-ivanyuta",
$User
)
if ($User -is [String]) {
$Connection = Get-Credential -Credential $User
}
if ($Connection -eq $null){
foreach ($Comp in $Computer){
$Install_soft = gwmi win32_product -ComputerName $Comp |
where {$_.... |
combined_dataset/train/non-malicious/sample_32_49.ps1 | sample_32_49.ps1 | ConvertFrom-StringData @'
###PSLOC
TestAD = Testing AD Credential can query LDAP. Result '{0}'. Expected '{1}'
NoADModule = Active Directory PS Module unavailable. Install Active Directory PS Module.
TestLocalCredential = Testing Local credential {0} is admin on '{1}', result '{2}'. Expected '{3}'
TestClusterNodeN... |
combined_dataset/train/non-malicious/sample_54_58.ps1 | sample_54_58.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/New-ScriptCmdlet.ps1 | New-ScriptCmdlet.ps1 | # http://blogs.msdn.com/powershell/archive/2008/05/09/fun-with-script-cmdlets.aspx
########################################################################################
# function New-ScriptCmdlet() {
[CmdletBinding(DefaultParameterSetName="Type")]
PARAM(
[Parameter(ParameterSetName="Type",ValueFromPipeline=... |
combined_dataset/train/non-malicious/gpupdate on remote pc's_1.ps1 | gpupdate on remote pc's_1.ps1 | ###############################################################################
#
# Get all servers from a OU and run GPUpdate /force on this machines.
#
# Version 1.0
#
# (C) 2009 - Arne Fokkema
# www.ict-freak.nl
#
# Install the Quest AD cmdlets first!!
#
###############################################... |
combined_dataset/train/non-malicious/sample_17_6.ps1 | sample_17_6.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 = '81.0.0'
# Supported P... |
combined_dataset/train/non-malicious/New-XVM_15.ps1 | New-XVM_15.ps1 | #EXAMPLES
<#
New-XVM -ComputerName CNSHHYPERVSVR02 -Name "WS2012-TESTSVR01" -SwitchName "External(192.168.1.0/24)" -VhdType NoVHD
New-XVM -ComputerName CNSHHYPERVSVR02 -Name "WS2012-TESTSVR02" -SwitchName "External(192.168.1.0/24)" -VhdType ExistingVHD -VhdPath D:\\vhds\\WS2012-TESTSVR02.vhdx
New-XVM -ComputerName ... |
combined_dataset/train/non-malicious/2022.ps1 | 2022.ps1 |
try {
if ( ! $IsWindows ) {
$PSDefaultParameterValues['it:skip'] = $true
}
Describe " WSMan SessionOption object" -Tag @("CI") {
It "The SessionOption type exists" {
"Microsoft.WSMan.Management.SessionOption" -as "Type" | Should -Not -BeNullOrEmpty
}
It "The Ses... |
combined_dataset/train/non-malicious/Get-TopProcess_1.ps1 | Get-TopProcess_1.ps1 |
param(
[string] $sortCriteria = "Processor",
[int] $Count = 5
)
function main
{
## Store the performance counters we need
## for the CPU, and Disk I/O numbers
$cpuPerfCounters = @{}
$ioOtherOpsPerfCounters = @{}
$ioOtherBytesPerfCounters = @{}
$ioDataOpsPerfC... |
combined_dataset/train/non-malicious/sample_9_5.ps1 | sample_9_5.ps1 | ConvertFrom-StringData @'
id_printerkb982728checkrt=Printer mapping may fail with an error message when you try to create a Point and Print connection and a Kyocera printer is installed
'@
# SIG # Begin signature block
# MIIoRgYJKoZIhvcNAQcCoIIoNzCCKDMCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorB... |
combined_dataset/train/non-malicious/sample_57_66.ps1 | sample_57_66.ps1 | #
# Module manifest for module 'OCI.PSModules.Cloudmigrations'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Cloudmigrations.dll'
# Version number of this module.
ModuleVersion = '83.3.0'
# Supported P... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.