full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/288.ps1 | 288.ps1 | function Disable-PSFTaskEngineTask
{
[CmdletBinding(HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Disable-PSFTaskEngineTask')]
Param (
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
[PSFramework.TaskEngine.PsfTask[]]
$Task
)
process
{
foreach ($item in $Task)
{
i... |
combined_dataset/train/non-malicious/sample_16_59.ps1 | sample_16_59.ps1 | @{
GUID="EEFCB906-B326-4E99-9F54-8B4BB6EF3C6D"
Author="PowerShell"
CompanyName="Microsoft Corporation"
Copyright="Copyright (c) Microsoft Corporation."
ModuleVersion="7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion="3.0"
NestedModules="Microsoft.PowerShell.Commands.Management.dll"
HelpInfoURI = 'https://aka... |
combined_dataset/train/non-malicious/sample_5_18.ps1 | sample_5_18.ps1 | ConvertFrom-StringData @'
id_ctsrpc=Remote Procedure Call (RPC)
id_ctsrpcdescription=Collects information about Remote Procedure Call (RPC).
'@
# SIG # Begin signature block
# MIIoUgYJKoZIhvcNAQcCoIIoQzCCKD8CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# K... |
combined_dataset/train/non-malicious/Get-PipeLineObject_1.ps1 | Get-PipeLineObject_1.ps1 | # For TabExpansion.ps1
# this requires latest TabExpansion.ps1 in a same directory
function Get-PipeLineObject {
$i = -2
$property = $null
do {
$str = $line.Split("|")
# extract the command name from the string
# first split the string into statements and pipeline elements
... |
combined_dataset/train/non-malicious/sample_40_90.ps1 | sample_40_90.ps1 | var state = command.getTrait("state");
var manipData = services.manipulators.getManipulatorData("CameraManipulator");
var mode = manipData.getTrait("CameraManipulationMode");
var tool = new Object();
tool.activate = function () {
state.value = 2;
mode.value = 2; // Orbit mode
}
tool.deactivate = fun... |
combined_dataset/train/non-malicious/373.ps1 | 373.ps1 | Describe "Select-PSFObject Unit Tests" -Tag "UnitTests" {
$object = [PSCustomObject]@{
Foo = 42
Bar = 18
Tara = 21
}
$object2 = [PSCustomObject]@{
Foo = 42000
Bar = 23
}
$list = @()
$list += $object
$list += [PSCustomObject]@{
Foo = 23
Bar = 88
Tara = 28
}
Describe "Basic DSL... |
combined_dataset/train/non-malicious/1085.ps1 | 1085.ps1 |
Set-StrictMode -Version 'Latest'
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve)
$EnvVarName = "CarbonRemoveEnvironmentVar"
function Assert-NoTestEnvironmentVariableAt( $Scope )
{
$actualValue = [Environment]::GetEnvironmentVariable($EnvVarName, $Scope)
It ('sho... |
combined_dataset/train/non-malicious/PowerShell Talk Chickens.ps1 | PowerShell Talk Chickens.ps1 | #The PowerShell Talk
#Virtualization Congress 2009
#
#The Chicken Counter Script
#Get our cretendials
#More on credential stores: http://professionalvmware.com/2009/04/09/posh-article-of-the-week-secure-credential-storage/
$credentials = Get-VICredentialStoreItem -File "c:\\scripts\\really_secure_file.xml"
... |
combined_dataset/train/non-malicious/sample_50_4.ps1 | sample_50_4.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
function Register-EditorCommand {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Name,
... |
combined_dataset/train/non-malicious/sample_42_32.ps1 | sample_42_32.ps1 | /* eslint-disable no-undef */
var plugin = require("plugin-vs-v2");
if (typeof plugin != "undefined") {
plugin.Messaging.addEventListener("pluginready", function () {
setHtmlText();
});
}
function setHtmlText() {
// resource strings used by docker.web.default.html
setTextContent("#dockerWebCor... |
combined_dataset/train/non-malicious/sample_56_10.ps1 | sample_56_10.ps1 | parameters:
- name: federatedServiceConnection
type: string
- name: outputVariableName
type: string
# Resource to get a token for. Common values include:
# - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps
# - 'https://storage.azure.com/' for storage
# Defaults to Azure DevOps
- name: resource
type: strin... |
combined_dataset/train/non-malicious/Set-PowerGUIWelcomePage_3.ps1 | Set-PowerGUIWelcomePage_3.ps1 | ########################################################
# Modifies the default PowerGUI admin console
# welcome screen to the mht file you supply
# Details available at:
# http://dmitrysotnikov.wordpress.com/2009/02/11/rebranding-powergui-console/
########################################################
# Usage... |
combined_dataset/train/non-malicious/sample_48_81.ps1 | sample_48_81.ps1 | # Localized 05/06/2022 11:08 PM (GMT) 303:7.0.30723 ArchiveResources.psd1
# Localized ArchiveResources.psd1
ConvertFrom-StringData @'
###PSLOC
PathNotFoundError=The path '{0}' either does not exist or is not a valid file system path.
ExpandArchiveInValidDestinationPath=The path '{0}' is not a valid file system ... |
combined_dataset/train/non-malicious/3947.ps1 | 3947.ps1 |
function Test-VirtualNetworkAvailableEndpointServicesList
{
$resourceTypeParent = "Microsoft.Network/virtualNetworks"
$location = Get-ProviderLocation $resourceTypeParent
try
{
$results = Get-AzVirtualNetworkAvailableEndpointService -Location $location;
Assert-NotNull $re... |
combined_dataset/train/non-malicious/sample_33_39.ps1 | sample_33_39.ps1 | . ./Stop-Process2.ps1
notepad.exe
notepad.exe
notepad.exe
Stop-Process2 -Name "notepad"
# SIG # Begin signature block
# MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCA4mt... |
combined_dataset/train/non-malicious/sample_29_71.ps1 | sample_29_71.ps1 | #
# Module manifest for module 'OCI.PSModules.Networkfirewall'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Networkfirewall.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Supported P... |
combined_dataset/train/non-malicious/sample_62_1.ps1 | sample_62_1.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_49_47.ps1 | sample_49_47.ps1 | #
# Module manifest for module 'OCI.PSModules.Datascience'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Datascience.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Supported PSEdition... |
combined_dataset/train/non-malicious/CreateSite_tmp.ps1 | CreateSite_tmp.ps1 | # the order of the set custom WSP template
# Список необходимого для использования личн
... |
combined_dataset/train/non-malicious/sample_66_7.ps1 | sample_66_7.ps1 | #
# This script handles common telemetry tasks for Install.ps1 and Add-AppDevPackage.ps1.
#
function IsVsTelemetryRegOptOutSet()
{
$VsTelemetryRegOptOutKeys = @(
"HKLM:\SOFTWARE\Policies\Microsoft\VisualStudio\SQM",
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\VSCommon\16.0\SQM",
"HKLM:\S... |
combined_dataset/train/non-malicious/sample_57_18.ps1 | sample_57_18.ps1 | <##############################################################
# #
# Copyright (C) Microsoft Corporation. All rights reserved. #
# #
###########################################################... |
combined_dataset/train/non-malicious/1046.ps1 | 1046.ps1 |
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve)
Describe 'Test-PathIsJunction' {
function Invoke-TestPathIsJunction($path)
{
return Test-PathIsJunction $path
}
BeforeEach {
$Global:Error.Clear()
}
AfterEach {
Get-Child... |
combined_dataset/train/non-malicious/sample_37_74.ps1 | sample_37_74.ps1 | #=======================================================================================================================================================================
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# Description:
#
# ModifyProxySettings.ps1 - To be used by the installer - Mo... |
combined_dataset/train/non-malicious/975.ps1 | 975.ps1 |
$SubscriptionId = ''
$resourceGroupName = "myResourceGroup-$(Get-Random)"
$location = "westus2"
$adminSqlLogin = "SqlAdmin"
$password = "ChangeYourAdminPassword1"
$serverName = "server-$(Get-Random)"
$databaseName = "mySampleDatabase"
$restoreDatabaseName = "MySampleDatabase_GeoRestore"
$pointInTimeRestoreDatabas... |
combined_dataset/train/non-malicious/sample_67_2.ps1 | sample_67_2.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/2732.ps1 | 2732.ps1 |
[CmdletBinding()]
Param (
[Parameter(Mandatory=$false)]
[int32]$BackMins=180
)
$BackTime=(Get-Date) - (New-TimeSpan -Minutes $BackMins)
$RawEvents = Get-WinEvent -LogName "Microsoft-Windows-Sysmon/Operational" | Where-Object {$_.TimeCreated -ge $BackTime} | Where-Object { $_.Id -eq 3}
$RawEvents | ForEach-Obje... |
combined_dataset/train/non-malicious/sample_5_3.ps1 | sample_5_3.ps1 | ConvertFrom-StringData @'
id_rpcunauthenticatedsessions_sd=RPC is set to Restrict Unauthenticated RPC client session setups
'@
# SIG # Begin signature block
# MIIoKQYJKoZIhvcNAQcCoIIoGjCCKBYCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAI... |
combined_dataset/train/non-malicious/New-SelfSignedCertificat.ps1 | New-SelfSignedCertificat.ps1 | ##############################################################################\n##\n## New-SelfSignedCertificate\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... |
combined_dataset/train/non-malicious/sample_63_36.ps1 | sample_63_36.ps1 | #
# Module manifest for module 'OCI.PSModules.Resourcemanager'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Resourcemanager.dll'
# Version number of this module.
ModuleVersion = '85.1.0'
# Supported P... |
combined_dataset/train/non-malicious/Set-OCSUser_1.ps1 | Set-OCSUser_1.ps1 | ###########################################################################"
#
# NAME: Set-OCSUser.ps1
#
# AUTHOR: Jan Egil Ring
# EMAIL: jan.egil.ring@powershell.no
#
# COMMENT: Requires Quest AD cmdlets. This script sets Active Directory user attributes for Microsoft Office Communications Server 2007.
# ... |
combined_dataset/train/non-malicious/sample_54_80.ps1 | sample_54_80.ps1 | # ------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
# ------------------------------------------------------------
param (
[Parameter(Manda... |
combined_dataset/train/non-malicious/viewAllTemplate.ps1 | viewAllTemplate.ps1 | <# view all template wsp on custom site url
based on
http://www.danielbrown.id.au/Lists/Posts/Post.aspx?ID=74
#>
$site = Get-SPSite "http://spf"
$web = $site.OpenWeb();
foreach($lang in $web.RegionalSettings.InstalledLanguages)
{
Write-Host "Displaying Sites for Langauge: ... |
combined_dataset/train/non-malicious/ConvertTo-Hex_1.ps1 | ConvertTo-Hex_1.ps1 | # Ported from C# technique found here: http://forums.asp.net/p/1298956/2529558.aspx
param ( [string]$SidString )
# Create SID .NET object using SID string provided
$sid = New-Object system.Security.Principal.SecurityIdentifier $sidstring
# Create a byte array of the proper length
$sidBytes = New-Object byte[] ... |
combined_dataset/train/non-malicious/4455.ps1 | 4455.ps1 |
function Install-PSResource {
[OutputType([void])]
[cmdletbinding(SupportsShouldProcess = $true)]
Param
(
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
Position = 0,
Parameter... |
combined_dataset/train/non-malicious/2532.ps1 | 2532.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
$thresholdspace = 65
[int]$EventNum = 3
[int]$ProccessNumToFetch = 10
$ListOfAttachments... |
combined_dataset/train/non-malicious/1378.ps1 | 1378.ps1 |
function Get-CFirewallRule
{
[CmdletBinding(DefaultParameterSetName='All')]
[OutputType([Carbon.Firewall.Rule])]
param(
[Parameter(Mandatory=$true,ParameterSetName='ByName')]
[string]
$Name,
[Parameter(Mandatory=$true,ParameterSetName='ByLiteralName')]
... |
combined_dataset/train/non-malicious/sample_40_51.ps1 | sample_40_51.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_47_26.ps1 | sample_47_26.ps1 | ## Copyright (c) Microsoft Corporation. All rights reserved.
<#
.SYNOPSIS
This cmdlet collects a performance recording of Microsoft Defender Antivirus
scans.
.DESCRIPTION
This cmdlet collects a performance recording of Microsoft Defender Antivirus
scans. These performance recordings contain Microsoft-Antimal... |
combined_dataset/train/non-malicious/1013.ps1 | 1013.ps1 |
$random = (New-Guid).ToString().Substring(0,8)
$subscriptionId = "my-azure-subscription-id"
$apiManagementName = "apim-$random"
$resourceGroupName = "apim-rg-$random"
$location = "Japan East"
$organisation = "Contoso"
$adminEmail = "admin@contoso.com"
$storageAccountName = "backup$random"
$containerName = "... |
combined_dataset/train/non-malicious/sample_35_22.ps1 | sample_35_22.ps1 |
function New-AzDataProtectionPolicyTriggerScheduleClientObject{
[OutputType('System.String[]')]
[CmdletBinding(PositionalBinding=$false)]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Description('Creates new Schedule object')]
param (
[Parameter(Mandatory, HelpMessage='Days with whic... |
combined_dataset/train/non-malicious/Pastebin Functions.ps1 | Pastebin Functions.ps1 | ## Send-Paste (aka sprunge for Pastebin)
##############################################################################################################
## Uploads code to any pastebin.com based pastebin site and returns the url for you.
################################################################################... |
combined_dataset/train/non-malicious/882.ps1 | 882.ps1 |
New-AzResourceGroup -Name myResourceGroupAG -Location eastus
$backendSubnetConfig = New-AzVirtualNetworkSubnetConfig `
-Name myBackendSubnet `
-AddressPrefix 10.0.1.0/24
$agSubnetConfig = New-AzVirtualNetworkSubnetConfig `
-Name myAGSubnet `
-AddressPrefix 10.0.2.0/24
$vnet = New-AzVirtualNetwork `
-Resour... |
combined_dataset/train/non-malicious/sample_51_98.ps1 | sample_51_98.ps1 | #
# Module manifest for module 'OCI.PSModules.Networkloadbalancer'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Networkloadbalancer.dll'
# Version number of this module.
ModuleVersion = '75.1.0'
# Sup... |
combined_dataset/train/non-malicious/2063.ps1 | 2063.ps1 |
Describe "ScriptBlock.GetNewClosure()" -tags "CI" {
BeforeAll {
function SimpleFunction_GetNewClosure
{
param([ValidateNotNull()] $Name)
& { 'OK' }.GetNewClosure()
}
function ScriptCmdlet_GetNewClosure
{
... |
combined_dataset/train/non-malicious/sample_24_69.ps1 | sample_24_69.ps1 | #
# Module manifest for module 'OCI.PSModules.Certificates'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Certificates.dll'
# Version number of this module.
ModuleVersion = '73.1.0'
# Supported PSEditi... |
combined_dataset/train/non-malicious/1054.ps1 | 1054.ps1 |
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve)
}
function Test-ShouldDetect32BitProcess
{
$expectedResult = ( $env:PROCESSOR_ARCHITECTURE -eq 'x86' )
Assert-Equal $expectedResult (Test-PowerShellIs32Bit)
}
|
combined_dataset/train/non-malicious/242.ps1 | 242.ps1 | function Resolve-ShortURL
{
[CmdletBinding()]
[OutputType([System.String])]
PARAM
(
[String[]]$ShortUrl
)
FOREACH ($URL in $ShortUrl)
{
TRY
{
Write-Verbose -Message "$URL - Querying..."
(Invoke-WebRequest -Uri $URL -MaximumRedirection 0 -Err... |
combined_dataset/train/non-malicious/sample_11_5.ps1 | sample_11_5.ps1 | <#
.SYNOPSIS
NewSelfSignedCertificate.ps1 script file
This is a place-holder file only for agent patch build purposes
#>
Write-Host "This file functionality is deprecated and is place-holder only"
# SIG # Begin signature block
# MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# ... |
combined_dataset/train/non-malicious/2963.ps1 | 2963.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"
} |
combined_dataset/train/non-malicious/sample_66_95.ps1 | sample_66_95.ps1 | #
# Module manifest for module 'OCI.PSModules.Stackmonitoring'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Stackmonitoring.dll'
# Version number of this module.
ModuleVersion = '86.2.0'
# Supported P... |
combined_dataset/train/non-malicious/sample_0_49.ps1 | sample_0_49.ps1 | ConvertFrom-StringData @'
id_ctsnetworkstoreinterface=Network Store Interface
id_ctsnetworkstoreinterfacedescription=Collects information about the Network Store Interface component.
'@
# SIG # Begin signature block
# MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgE... |
combined_dataset/train/non-malicious/PowerChart _1.5.ps1 | PowerChart _1.5.ps1 | function New-PowerChart() {
[CmdletBinding(DefaultParameterSetName='DataTemplate')]
param(
[Parameter(Position=0, Mandatory=$true)]
[ValidateSet("Area","Bar","Bubble","Column","Line","Pie","Scatter")]
[String[]]
${ChartType}
,
[Parameter(Position=1, Mandatory=$true, HelpMessage='The data for... |
combined_dataset/train/non-malicious/1600.ps1 | 1600.ps1 |
function Get-PdfText
{
[CmdletBinding()]
[OutputType([string])]
param (
[Parameter(Mandatory = $true)]
[string]
$Path
)
$Path = $PSCmdlet.GetUnresolvedProviderPathFromPSPath($Path)
try
{
$reader = New-Object iTextSharp.text.pdf.pdfreader -ArgumentList $P... |
combined_dataset/train/non-malicious/sample_47_4.ps1 | sample_47_4.ps1 | #
# Module manifest for module 'OCI.PSModules.Bds'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Bds.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported PSEditions
CompatiblePSEd... |
combined_dataset/train/non-malicious/1890.ps1 | 1890.ps1 |
Describe "String cmdlets" -Tags "CI" {
Context "Select-String" {
BeforeAll {
$sep = [io.path]::DirectorySeparatorChar
$fileName = New-Item 'TestDrive:\selectStr[ingLi]teralPath.txt'
"abc" | Out-File -LiteralPath $fileName.fullname
"bcd" | Out-File -LiteralPath ... |
combined_dataset/train/non-malicious/Get-ADGroupMembers_3.ps1 | Get-ADGroupMembers_3.ps1 | Function Get-ADGroupMembers
{
<#
.SYNOPSIS
Return a collection of users in an ActiveDirectory group.
.DESCRIPTION
This function returns an object that contains all the properties of a user object. This function
works for small groups as well as groups in ex... |
combined_dataset/train/non-malicious/356.ps1 | 356.ps1 | function Set-PSFLoggingProvider
{
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")]
[CmdletBinding(HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Set-PSFLoggingProvider')]
Param (
[Alias('Provider', 'ProviderName')]
[string]
$Name,
... |
combined_dataset/train/non-malicious/sample_49_43.ps1 | sample_49_43.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/sample_66_26.ps1 | sample_66_26.ps1 | #
# Module manifest for module 'OCI.PSModules.Bastion'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Bastion.dll'
# Version number of this module.
ModuleVersion = '84.0.0'
# Supported PSEditions
Compat... |
combined_dataset/train/non-malicious/New-CodeSigningCertifica.ps1 | New-CodeSigningCertifica.ps1 | #####################################################################
# New-CodeSigningCertificate.ps1
# Version 1.0
#
# Creates new self-signed code signing certificate and installs it to
# current user's personal store. Supports Windows XP and higher.
#
# Initially script was developed for Quest PowerGUI Scrip... |
combined_dataset/train/non-malicious/Write-IseFile.ps1 | Write-IseFile.ps1 | function Write-IseFile($file, $msg)
{
$Editor = $file.Editor
$Editor.SetCaretPosition($Editor.LineCount, 1)
$Editor.InsertText(($msg + "`r`n"))
}
|
combined_dataset/train/non-malicious/Get-Gender_1.ps1 | Get-Gender_1.ps1 | ## This script serves three purposes:
## 1) You can look up whether a name is masculine or feminine
## -- even for foreign names.
## 2) It demonstrates the use of the HttpRest functions
## 3) It demonstrates memory-caching:
## how to write a SCRIPT ...
## that becomes a FUNCTION the first time you use it... |
combined_dataset/train/non-malicious/sample_8_20.ps1 | sample_8_20.ps1 | #************************************************
# TS_IntersiteMessagingStateCheck.ps1
# Version 1.0.1
# Date: 6/6/2012
# Author: v-kaw
# Description: [Idea ID 2882] [Windows] The stop of Intersite Messaging service on ISTG causes DFSN cannot calculate site costs
# Rule number: 2882
# Rule URL: http://sharep... |
combined_dataset/train/non-malicious/sample_6_50.ps1 | sample_6_50.ps1 | // ===========================================================================================================================
// Class DCIM_AccountService
// ===========================================================================================================================
[
Description ("DCIM_rfsensor... |
combined_dataset/train/non-malicious/628b551c-7932-48ee-843d-243be07d7546.ps1 | 628b551c-7932-48ee-843d-243be07d7546.ps1 | function Set-Encoding{
<#
.Synopsis
Takes a Script file or any other text file into memory
and Re-Encodes it in the format specified.
.Parameter FilePath
The path to the file to be re-encoded.
.Parameter Unicode
Outputs the file in Unicode format.
.Parameter UTF7
Outputs the file in UTF7 format.... |
combined_dataset/train/non-malicious/577.ps1 | 577.ps1 |
function Uninstall-SPOSolution
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true, Position=1)]
[string]$solutionName
)
Write-Host "Deactivate solution $path" -foregroundcolor black -backgroundcolor yellow
Switch-SPOEnableDisableSolution -solutionName $solutionName -activate $false
Write-Host ... |
combined_dataset/train/non-malicious/1141.ps1 | 1141.ps1 |
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve)
function GivenANormalFile
{
$file = Join-Path -Path $TestDrive.FullName -ChildPath 'file'
'' | Set-Content -Path $file
Get-Item -Path $file
}
Describe 'Carbon.when getting normal files' {
$file = GivenANormal... |
combined_dataset/train/non-malicious/3723.ps1 | 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;
}
}... |
combined_dataset/train/non-malicious/598.ps1 | 598.ps1 | function Load-SQLServerManagementObjects{
$ErrorActionPreference = "Stop"
$sqlpsreg="HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps"
if (Get-ChildItem $sqlpsreg -ErrorAction "SilentlyContinue")
{
throw "SQL Server Provider for Windows PowerShell is not installed... |
combined_dataset/train/non-malicious/ShowUI Clock 5.ps1 | ShowUI Clock 5.ps1 | New-UIWidget {
Grid {
$shadow = DropShadowEffect -ShadowDepth 0 -BlurRadius 5 -Direction 0
Ellipse -Name Hour -Fill Transparent -Stroke Black -StrokeThickness 100 -Width 350 -Height 350 -StrokeDashArray 7.85,7.85 -RenderTransformOrigin "0.5,0.5" -RenderTransform { RotateTransform -Angle -90 }
... |
combined_dataset/train/non-malicious/4385.ps1 | 4385.ps1 | function Get-NormalizedVersionString
{
param
(
[Parameter(Mandatory = $true)]
[string]
$Version
)
[Version]$ParsedVersion = $null
if ([System.Version]::TryParse($Version, [ref]$ParsedVersion)) {
$Build = $ParsedVersion.Build
if ($Build -eq -1) {
... |
combined_dataset/train/non-malicious/POC-adding custom PS job_1.ps1 | POC-adding custom PS job_1.ps1 | #this is just a quite proof of concept, totally useless in of itself, with functions not fleshed out
function get-jobrepository
{
[CmdletBinding()]
param()
$pscmdlet.JobRepository
}
function add-job
{
[CmdletBinding()]
param($job)
$pscmdlet.JobRepository.add($job)
}
$src = @"
using System;
using Sy... |
combined_dataset/train/non-malicious/2390.ps1 | 2390.ps1 |
function Enable-FileEncryption
{
[OutputType([void])]
[CmdletBinding()]
param
(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[System.IO.FileInfo]$File
)
begin {
$ErrorActionPreference = 'Stop'
}
process {
try
{
$File.Encrypt()
}
catch
{
$PSCmdlet.ThrowTerminat... |
combined_dataset/train/non-malicious/Move-FileSafely.ps1 | Move-FileSafely.ps1 | function global:Move-FileSafely {
#.Synopsis
# Moves files and folders from $source folder to $destination
#.Description
# Moves files from $source to $destination but if they already exist, it puts them in a parallel $BackupCopies folder instead
#.Parameter Source
# The path to the source directory
#.Parame... |
combined_dataset/train/non-malicious/sample_36_36.ps1 | sample_36_36.ps1 | 20 / 31 [MS-3DMDTP] - v20240416 Data Visualization: 3-D Map Data Tour File Format Copyright © 2024 Microsoft Corporation Release: April 16, 2024 22eP1uV86AsOoTR60vCA+rkQ8ESx4eH/ShGPOQfhVr8GmXK8LXCVF8MnF9nNMH5iR5LBh1EQ/ce++9tnz5cmfKsn9kcVmxYoWtXr3alU+bNs3FhQzGkvlnTpERxrcgNBQ3fL6iwg6d+NT+52+X2sIN++3a5Ys2ZnAP+4cffNX6dO/sC... |
combined_dataset/train/non-malicious/sample_5_40.ps1 | sample_5_40.ps1 | @{
# Script module or binary module file associated with this manifest.
RootModule = 'Microsoft.ServiceFabric.Powershell'
# Version number of this module.
ModuleVersion = '3.1.0.0'
# ID used to uniquely identify this module
GUID = 'd2c42633-5254-4a82-a312-1dc0697a55cd'
# Author of this module
Author = '... |
combined_dataset/train/non-malicious/3299.ps1 | 3299.ps1 |
function Stop-Poshbot {
[cmdletbinding(SupportsShouldProcess, ConfirmImpact = 'high')]
param(
[parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[int[]]$Id,
[switch]$Force
)
begin {
$remove = @()
}
process {
foreach ($jobId... |
combined_dataset/train/non-malicious/Cluster Windows.ps1 | Cluster Windows.ps1 | #Comprobacion del estado de los clusters#
#########################################
# Add Exchange Admin module
If ((Get-PSSnapin | where {$_.Name -match "Exchange.Management"}) -eq $null)
{
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
}
#Fichero donde estan los nombres de los cluster
$activos= ... |
combined_dataset/train/non-malicious/959.ps1 | 959.ps1 |
$apiVersion = "2015-04-08"
$resourceGroupName = "myResourceGroup"
$accountName = "mycosmosaccount"
$databaseName = "database1"
$databaseThroughputResourceName = $accountName + "/mongodb/" + $databaseName + "/throughput"
$databaseThroughputResourceType = "Microsoft.DocumentDb/databaseAccounts/apis/databases/settings"
$... |
combined_dataset/train/non-malicious/sample_1_74.ps1 | sample_1_74.ps1 | ConvertFrom-StringData @'
id_certs=Certificate information
id_certsdesc=Collecting information on installed certificates
'@
# SIG # Begin signature block
# MIIoQwYJKoZIhvcNAQcCoIIoNDCCKDACAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBA... |
combined_dataset/train/non-malicious/9db524e2-1659-493b-ad36-3624e7796a76.ps1 | 9db524e2-1659-493b-ad36-3624e7796a76.ps1 | ## Simplest RSS Reader\n####################################################################################################\n## Save this file as Start-RssReader.ps1\n## Run it like:\n## .\\Start-RssReader "http://feeds.feedburner.com/powerscripting", "http://HuddledMasses.org/feed"\n## And then:\n## Get-RSS ... |
combined_dataset/train/non-malicious/push-module function v2 .ps1 | push-module function v2 .ps1 | # v2.0
function Push-Module {
param(
[parameter(position=0, mandatory=$true)]
[validatenotnullorempty()]
[string]$ModuleName
)
# find out what this module exports (and therefore what it overwrites)
$metadata = new-module -ascustomobject {
param([string]$M... |
combined_dataset/train/non-malicious/sample_22_58.ps1 | sample_22_58.ps1 | #Volumetric soil moisture content
'Volumetric soil moisture content' = {
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 9 ;
}
#Upper layer soil temperature
'Upper layer soil temperature' = {
discipline = 2 ;
parameterCategory = 3 ;
parameterNumber = 1 ;
}
#Upper layer soil moisture
'Upper laye... |
combined_dataset/train/non-malicious/Get Twitter RSS Feed_5.ps1 | Get Twitter RSS Feed_5.ps1 | param ([String] $ScreenName)
$client = New-Object System.Net.WebClient
$idUrl = "https://api.twitter.com/1/users/show.json?screen_name=$ScreenName"
$data = $client.DownloadString($idUrl)
$start = 0
$findStr = '"id":'
do {
$start = $data.IndexOf($findStr, $start + 1)
if ($start -gt 0) {
$s... |
combined_dataset/train/non-malicious/Get-HtmlHelp 3.0.ps1 | Get-HtmlHelp 3.0.ps1 | ## Get-HtmlHelp - by Joel Bennett
## version 3.0
#####################################################################
## Cool Example, using ShowUI:
## Import-Module HtmlHelp
## Import-Module ShowUI
## function Show-Help { [CmdletBinding()]param([String]$Name)
## Window { WebBrowser -Name wb } ... |
combined_dataset/train/non-malicious/sample_38_40.ps1 | sample_38_40.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/sample_17_80.ps1 | sample_17_80.ps1 | $FileToCollect = Join-Path $Env:windir "system32\catroot2\dberr.txt"
$SectionDescription = "Catalog registration files"
$FileDescription = "SP Catalog Logging file"
Import-LocalizedData -BindingVariable DCStrings
Write-DiagProgress -activity $DCStrings.ID_DBErrCollecting -status $DCStrings.ID_DBErrCollectingDes... |
combined_dataset/train/non-malicious/WPFDiskSpace_1.ps1 | WPFDiskSpace_1.ps1 | #.Example
# Get-WmiObject -computername Z002 Win32_LogicalDisk -filter "DriveType=3" | New-DiskSpace
#.Note
# Requires ShowUI 1.1 and Visifire (You must use Add-UIModule on the Visifire dll and then import it)
function New-DiskSpace {
param([Parameter(ValueFromPipeline=$true)]$InputObject)
begin {
$cha... |
combined_dataset/train/non-malicious/3362.ps1 | 3362.ps1 |
[CmdletBinding(
DefaultParameterSetName='Scope',
SupportsShouldProcess=$true
)]
param(
[Parameter(ParameterSetName='Scope', Mandatory = $true, Position = 0)]
[ValidateSet("AzureRMAndDependencies", "AzureAndDependencies", "NetCoreModules", "AzureStackAndDependencies")]
[string] $scope... |
combined_dataset/train/non-malicious/2526.ps1 | 2526.ps1 | [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null;
$smoObj = [Microsoft.SqlServer.Management.Smo.SmoApplication];
function Run-Query()
{
param (
$SqlQuery,
$SqlServer,
$SqlCatalog
)
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection("Data Source=$SqlServer;... |
combined_dataset/train/non-malicious/1374.ps1 | 1374.ps1 |
function Grant-CPermission
{
[CmdletBinding(SupportsShouldProcess=$true)]
[OutputType([Security.AccessControl.AccessRule])]
param(
[Parameter(Mandatory=$true)]
[string]
$Path,
[Parameter(Mandatory=$true)]
[string]
$Identity,
... |
combined_dataset/train/non-malicious/sample_67_12.ps1 | sample_67_12.ps1 | #
# Module manifest for module 'OCI.PSModules.Fleetsoftwareupdate'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Fleetsoftwareupdate.dll'
# Version number of this module.
ModuleVersion = '86.0.0'
# Sup... |
combined_dataset/train/non-malicious/sample_32_82.ps1 | sample_32_82.ps1 | function trySetDesignerProp(tname, ttype, val) {
var trait = document.designerProps.getOrCreateTrait(tname, ttype, 0);
trait.value = val;
}
if (command.getTrait("state").value == 0) {
command.getTrait("state").value = 2;
trySetDesignerProp("manipulationWorldMode", "bool", true);
}
else {
... |
combined_dataset/train/non-malicious/vibackup linux script.ps1 | vibackup linux script.ps1 | Param (
$viServer,
$bakVM,
$lxDest,
)
#region check
if (!$viServer) { $viServer = Read-Host -Prompt "VI Server " }
if (!$bakVM) { $bakVM = Read-Host -Prompt "VM to Backup " }
if (!$lxDest) { $lxDest = Read-Host -Prompt "Backup Path (ex. /srv/backup) " }
#endregion
#region globalvars
$encoding = "OEM"
... |
combined_dataset/train/non-malicious/1512.ps1 | 1512.ps1 |
function Assert-NotEqual
{
[CmdletBinding()]
param(
[Parameter(Position=0)]
$Expected,
[Parameter(Position=1)]
$Actual,
[Parameter(Position=2)]
$Message
)
if( $Expected -eq $Actual )
{
... |
combined_dataset/train/non-malicious/sample_67_50.ps1 | sample_67_50.ps1 | #!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Suppor... |
combined_dataset/train/non-malicious/978.ps1 | 978.ps1 |
$subscriptionId = '<Subscription-ID>'
$randomIdentifier = $(Get-Random)
$resourceGroupName = "myResourceGroup-$randomIdentifier"
$location = "East US"
$adminLogin = "azureuser"
$password = "PWD27!"+(New-Guid).Guid
$serverName = "mysqlserver-$randomIdentifier"
$poolName = "myElasticPool"
$databaseName = "mySampleDatab... |
combined_dataset/train/non-malicious/3728.ps1 | 3728.ps1 |
function Test-AlertChangeState
{
$alerts = Get-AzAlert -State "New" -TimeRange 1h
$alert = $alerts[0]
$oldState = $alert.State
$newState = "Closed"
$updatedAlert = Update-AzAlertState -AlertId $alert.Id -State $newState
Assert-AreEqual $newState $updatedAlert.State
$alert = Update-AzAlertSta... |
combined_dataset/train/non-malicious/Findup_6.ps1 | Findup_6.ps1 | using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.IO;
namespace Findup
{
public class FileInfoExt
{
public FileInfoExt(FileInfo fi)
... |
combined_dataset/train/non-malicious/4199.ps1 | 4199.ps1 |
[CmdletBinding()]
param
(
[ValidateNotNullOrEmpty()][string]$CollectionName = 'TSTBLD Systems',
[ValidateNotNullOrEmpty()][string]$SCCMServer = 'BNASCCM',
[ValidateNotNullOrEmpty()][string]$SCCMDrive = 'BNA',
[ValidateNotNullOrEmpty()][string]$ReportFile = 'PendingRebootReport.csv'
)
function Import-SCCMModule {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.