full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/557.ps1 | 557.ps1 |
function Add-SPOFolder
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true, Position=1)]
[string]$folderUrl
)
$folderNameArr = $folderurl.Split('/')
$folderName = $folderNameArr[$folderNameArr.length-1]
$folderUrl = Join-SPOParts -Separator '/' -Parts $clientContext.Web.ServerRelativeU... |
combined_dataset/train/non-malicious/2020.ps1 | 2020.ps1 |
Describe "SSHTransport switch parameter value" -Tags 'Feature' {
BeforeAll {
$TestCasesSSHTransport = @(
@{scriptBlock = {New-PSSession -HostName localhost -UserName UserA -SSHTransport:$false}; testName = 'New-PSSession SSHTransport parameter cannot have false value'}
@{scri... |
combined_dataset/train/non-malicious/1460.ps1 | 1460.ps1 |
function Copy-CDscResource
{
[CmdletBinding()]
[OutputType([IO.FileInfo])]
param(
[Parameter(Mandatory=$true)]
[string]
$Path,
[Parameter(Mandatory=$true)]
[string]
$Destination,
[Switch]
$Recurse,
[S... |
combined_dataset/train/non-malicious/91.ps1 | 91.ps1 |
function Get-AuthToken {
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)]
$User
)
$userUpn = New-Object "System.Net.Mail.MailAddress" -ArgumentList $User
$tenant = $userUpn.Host
Write-Host "Checking for AzureAD module..."
$AadModule = Get-Module -Name "AzureAD" -ListAvailable
if ($Aad... |
combined_dataset/train/non-malicious/sample_38_89.ps1 | sample_38_89.ps1 | #!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
$pathsep=":"
$env_node_path=$env:NODE_PATH
$new_node_path="C:\Users\abder\component-maker\web\node_modules\.pnpm\nanoid@3.3.7\node_modules\nanoid\bin\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\nanoid@3.3.... |
combined_dataset/train/non-malicious/sample_65_43.ps1 | sample_65_43.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 = '88.1.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/1160.ps1 | 1160.ps1 |
$tempDir = $null
$compressedDirPath = $null
$compressedFilePath = $null
$uncompressedDirPath = $null
$uncompressedFilePath = $null
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve)
}
function Start-Test
{
$tempDir = New-TempDirectoryT... |
combined_dataset/train/non-malicious/sample_43_96.ps1 | sample_43_96.ps1 | #
# Module manifest for module 'OCI.PSModules.Monitoring'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Monitoring.dll'
# Version number of this module.
ModuleVersion = '74.1.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/sample_0_80.ps1 | sample_0_80.ps1 | #************************************************
# TS_WMIHandleLeakKB2639077.ps1
# Version 1.0.1
# Date: 7/19/2013
# Author: v-kaw
# Description: [KSE Rule] [ Windows V3] Handle leak in Svchost.exe when a WMI query is triggered by using the Win32_PowerSettingCapabilities
# Rule number: 5c139a00-370c-4d1c-a929-... |
combined_dataset/train/non-malicious/sample_3_20.ps1 | sample_3_20.ps1 | #
# Module manifest for module 'OCI.PSModules.Oda'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Oda.dll'
# Version number of this module.
ModuleVersion = '93.0.0'
# Supported PSEditions
CompatiblePSEd... |
combined_dataset/train/non-malicious/sample_31_45.ps1 | sample_31_45.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 License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
combined_dataset/train/non-malicious/1023.ps1 | 1023.ps1 |
$rgName='MyResourceGroup'
$location='eastus'
$cred = Get-Credential -Message "Enter a username and password for the virtual machine."
New-AzResourceGroup -Name $rgName -Location $location
$as = New-AzAvailabilitySet -ResourceGroupName $rgName -Location $location `
-Name MyAvailabilitySet -Sku Aligned -Platform... |
combined_dataset/train/non-malicious/2895.ps1 | 2895.ps1 | Framework '4.0'
task default -depends MsBuild
task MsBuild {
if ( $IsMacOS -OR $IsLinux ) {}
else {
exec { msbuild /version /nologo }
}
}
|
combined_dataset/train/non-malicious/2130.ps1 | 2130.ps1 |
Describe 'NullConditionalOperations' -Tags 'CI' {
BeforeAll {
$skipTest = -not $EnabledExperimentalFeatures.Contains('PSCoalescingOperators')
if ($skipTest) {
Write-Verbose "Test Suite Skipped. The test suite requires the experimental feature 'PSCoalescingOperators' to be enabled." ... |
combined_dataset/train/non-malicious/2096.ps1 | 2096.ps1 |
$ProgressPreference = "SilentlyContinue"
Describe 'get-help HelpFunc1' -Tags "Feature" {
BeforeAll {
function TestHelpError {
[CmdletBinding()]
param(
$x,
[System.Management.Automation.ErrorRecord[]]$e,
[string] $expectedError
)
It 'Help result should b... |
combined_dataset/train/non-malicious/sample_28_96.ps1 | sample_28_96.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/3569.ps1 | 3569.ps1 |
function Get-AnalysisServicesServerName
{
return getAssetName
}
function Get-ResourceGroupName
{
return getAssetName
}
function Get-AnalysisServicesLocation
{
return Get-Location -providerNamespace "Microsoft.AnalysisServices" -resourceType "servers" -preferredLocation "West US"
}
funct... |
combined_dataset/train/non-malicious/Get-StaticMethodDefin_1.ps1 | Get-StaticMethodDefin_1.ps1 | #Steven Murawski
#http://blog.usepowershell.com
#03/20/2009
#Examples:
# get-staticmethoddefinition max math
# [math] | get-staticmethoddefinition max
function Get-StaticMethodDefinition()
{
param ([string[]]$Method, [Type]$Type=$null)
BEGIN
{
if ($Type -ne $null)
{
$Type | Get-StaticMethodDe... |
combined_dataset/train/non-malicious/Create a VIAccount.ps1 | Create a VIAccount.ps1 | function New-VIAccount($principal) {
$flags = `
[System.Reflection.BindingFlags]::NonPublic -bor
[System.Reflection.BindingFlags]::Public -bor
[System.Reflection.BindingFlags]::DeclaredOnly -bor
[System.Reflection.BindingFlags]::Instance
$method = $defaultviserver.GetType().GetMethods($flags) |... |
combined_dataset/train/non-malicious/sample_37_5.ps1 | sample_37_5.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 = '75.1.0'
# S... |
combined_dataset/train/non-malicious/944.ps1 | 944.ps1 |
$apiVersion = "2015-04-08"
$resourceGroupName = "myResourceGroup"
$accountName = "mycosmosaccount"
$databaseName = "database1"
$containerName = "container1"
$databaseThroughputResourceName = $accountName + "/sql/" + $databaseName + "/throughput"
$databaseThroughputResourceType = "Microsoft.DocumentDb/databaseAccounts/... |
combined_dataset/train/non-malicious/sample_67_69.ps1 | sample_67_69.ps1 | #
# Module manifest for module 'OCI.PSModules.Genericartifactscontent'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Genericartifactscontent.dll'
# Version number of this module.
ModuleVersion = '87.0.0... |
combined_dataset/train/non-malicious/Get-InstalledApps.ps1 | Get-InstalledApps.ps1 | Param([string]$server)
Begin{
function CheckRegKey{
param([string]$srv)
$key = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$type = [Microsoft.Win32.RegistryHive]::LocalMachine
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($type, $Srv)
$regKey... |
combined_dataset/train/non-malicious/2896.ps1 | 2896.ps1 | task default -depends test
task test {
Push-Location 'default_build_file'
$result = invoke-psake -Docs | Out-String -Width 120
Pop-Location
Assert ($result -match 'adefaulttask') 'Default build file should a task called adefaulttask'
}
|
combined_dataset/train/non-malicious/HuddledTricks.ps1 | HuddledTricks.ps1 | ## Stupid PowerShell Tricks
###################################################################################################
## Usage:
## ps Notepad | Hide-App
## Hide-App -Name PowerShell; Wiggle-Mouse 75 100
###################################################################################################
a... |
combined_dataset/train/non-malicious/4322.ps1 | 4322.ps1 | function Join-PathUtility
{
param
(
[Parameter(Mandatory = $true)]
[string]
$Path,
[Parameter(Mandatory = $false)]
[string]
$ChildPath,
[Parameter(Mandatory = $true)]
[string]
[ValidateSet('File', 'Directory', 'Any')]
$PathTy... |
combined_dataset/train/non-malicious/1676.ps1 | 1676.ps1 |
$VerbosePreference = 'Continue'
while (-not (Test-Path -Path 'C:\test.txt')) {
Start-Sleep -Seconds 1
Write-Verbose -Message "Still waiting for action to complete..."
}
$timer = [Diagnostics.Stopwatch]::StartNew()
$timer.Elapsed.TotalSeconds
$timer.Stop()
$timer = [Diagnostics.Stopwatch]::StartNew()
while (($t... |
combined_dataset/train/non-malicious/sample_36_66.ps1 | sample_36_66.ps1 | #
# Module manifest for module 'OCI.PSModules.Audit'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Audit.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/sample_65_63.ps1 | sample_65_63.ps1 | #
# Module manifest for module 'ThreadJob'
#
@{
# Script module or binary module file associated with this manifest.
RootModule = '.\Microsoft.PowerShell.ThreadJob.dll'
# Version number of this module.
ModuleVersion = '2.0.3'
# ID used to uniquely identify this module
GUID = '0e7b895d-2fec-43f7-8cae-11... |
combined_dataset/train/non-malicious/sample_23_17.ps1 | sample_23_17.ps1 |
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# 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 License at
# http://www.apa... |
combined_dataset/train/non-malicious/3498.ps1 | 3498.ps1 | function Write-InstallationCheckToFile
{
Param($installationchecks)
if (Get-Module Az.Profile -ListAvailable -ErrorAction Ignore)
{
Write-Warning "Both Az and AzureRM modules were detected on your machine. Az and AzureRM modules cannot be imported in the same session or used in the same script or ru... |
combined_dataset/train/non-malicious/1803.ps1 | 1803.ps1 |
$stopTesthook = "TestStopComputer"
$stopTesthookResultName = "TestStopComputerResults"
$DefaultResultValue = 0
try
{
$PSDefaultParameterValues["it:skip"] = ! $IsWindows
Enable-Testhook -testhookName $stopTesthook
Describe "Stop-Computer" -Tag Feature {
BeforeEach {
i... |
combined_dataset/train/non-malicious/230.ps1 | 230.ps1 | function Get-SCSMReviewActivityReviewer
{
[CmdletBinding(DefaultParameterSetName = 'Object')]
param
(
[Parameter(ParameterSetName = 'Object',
Mandatory = $true,
ValueFromPipeline = $true)]
$ActivityObject,
[Parameter(ParameterSetName = 'Na... |
combined_dataset/train/non-malicious/sample_44_67.ps1 | sample_44_67.ps1 | #
# Module manifest for module 'OCI.PSModules.Apmtraces'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Apmtraces.dll'
# Version number of this module.
ModuleVersion = '75.1.0'
# Supported PSEditions
Co... |
combined_dataset/train/non-malicious/1984.ps1 | 1984.ps1 |
Describe "New-Event" -Tags "CI" {
Context "Check return type of New-Event" {
It "Should return PSEventArgs as return type of New-Event" {
New-Event -SourceIdentifier a | Should -BeOfType System.Management.Automation.PSEventArgs
}
}
Context "Check New-Event can register an ev... |
combined_dataset/train/non-malicious/sample_15_81.ps1 | sample_15_81.ps1 | import { BundledLanguageInfo, DynamicImportLanguageRegistration } from '@shikijs/core';
declare const bundledLanguagesInfo: BundledLanguageInfo[];
declare const bundledLanguagesBase: {
[k: string]: DynamicImportLanguageRegistration;
};
declare const bundledLanguagesAlias: {
[k: string]: DynamicImportLanguageRe... |
combined_dataset/train/non-malicious/2008.ps1 | 2008.ps1 |
$script:CimClassName = "PSCore_CimTest1"
$script:CimNamespace = "root/default"
$script:moduleDir = Join-Path -Path $PSScriptRoot -ChildPath assets -AdditionalChildPath CimTest
$script:deleteMof = Join-Path -Path $moduleDir -ChildPath DeleteCimTest.mof
$script:createMof = Join-Path -Path $moduleDir -ChildPath CreateCi... |
combined_dataset/train/non-malicious/Test-Help_1.ps1 | Test-Help_1.ps1 | function Test-Help {
<#
.Synopsis
Test-Help -Function Get-USB
.Description
Test-Help was written to get information why that !@##$%#$%# help is not working ;)
Should work fine both with v1 and v2 comments.
Using fancy regex that probably could be shorter, more elegant ... |
combined_dataset/train/non-malicious/sample_23_13.ps1 | sample_23_13.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_21_48.ps1 | sample_21_48.ps1 | ConvertFrom-StringData @'
'@
# SIG # Begin signature block
# MIIoOQYJKoZIhvcNAQcCoIIoKjCCKCYCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCIAl2YjgT3q/2F
# K0cnnv6pcgXS1+O5EEc7uH4iva+8FqCCDYUwggYDMIID66ADAg... |
combined_dataset/train/non-malicious/sample_63_93.ps1 | sample_63_93.ps1 | ##------------------------------------------------------------------
## <copyright file="GMATenantJson.psm1" company="Microsoft">
## Copyright (C) Microsoft. All rights reserved.
## </copyright>
##------------------------------------------------------------------
$azureStackNugetPath = Get-ASArtifactPath -N... |
combined_dataset/train/non-malicious/302.ps1 | 302.ps1 | function Stop-PSFRunspace
{
[CmdletBinding(SupportsShouldProcess = $true, HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Stop-PSFRunspace')]
Param (
[Parameter(ValueFromPipeline = $true)]
[string[]]
$Name,
[Parameter(ValueFromPipeline = $true)]
[PSFramework.Runspace.RunspaceContai... |
combined_dataset/train/non-malicious/1119.ps1 | 1119.ps1 |
$siteName = 'CarbonSetIisMimeMap'
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot '..\Initialize-CarbonTest.ps1' -Resolve)
}
function Start-Test
{
Install-IisWebsite -Name $siteName -Binding 'http/*:48284:*' -Path $TestDir
}
function Stop-Test
{
Remove-IisWebsite -Name $siteName... |
combined_dataset/train/non-malicious/3932.ps1 | 3932.ps1 |
function Test-BastionCRUD
{
$rgname = Get-ResourceGroupName
$bastionName = Get-ResourceName
$resourceTypeParent = "Microsoft.Network/bastionHosts"
$location = Get-ProviderLocation $resourceTypeParent
$vnetName = Get-ResourceName
$subnetName = "AzureBastionSubnet"
$publ... |
combined_dataset/train/non-malicious/sample_54_96.ps1 | sample_54_96.ps1 | #
# Module manifest for module 'OCI.PSModules.Recovery'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Recovery.dll'
# Version number of this module.
ModuleVersion = '83.3.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/VB MsgBox Powershell.ps1 | VB MsgBox Powershell.ps1 | <#
.SYNOPSIS
Shows a graphical message box, with various prompt types available.
.DESCRIPTION
Emulates the Visual Basic MsgBox function. It takes four parameters, of which only the prompt is mandatory
.INPUTS
The parameters are:... |
combined_dataset/train/non-malicious/3775.ps1 | 3775.ps1 | param(
[Parameter(Mandatory=$true)]
$Configuraton)
$ErrorActionPreference = "Stop"
$scriptpath = $MyInvocation.MyCommand.Path
$scriptDirectory = Split-Path $scriptpath
$scriptFileName = Split-Path $scriptpath -Leaf
if (gcm Invoke-AzStorageSyncCompatibilityCheck -ErrorAction SilentlyContinue)
{
throw "Invo... |
combined_dataset/train/non-malicious/sample_12_32.ps1 | sample_12_32.ps1 | #
# Module manifest for module 'OCI.PSModules.Applicationmigration'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Applicationmigration.dll'
# Version number of this module.
ModuleVersion = '74.1.0'
# S... |
combined_dataset/train/non-malicious/Determine Computer Uptim.ps1 | Determine Computer Uptim.ps1 | <#
.SYNOPSIS
Demonstrates uptime using WMI
.DESCRIPTION
This script used Win32_ComputerSystem to determine how long your system
has been running. This is a rewrite/improvement of sample 3 at
http://msdn.microsoft.com/en-us/library/aa394591(VS.85).aspx.
.NOTES
File Name : Get-UpTime.ps1
... |
combined_dataset/train/non-malicious/2991.ps1 | 2991.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "New-PesterState" {
Context "TestNameFilter parameter is set" {
$p = new-pesterstate -TestNameFilter "filter"
it "sets the TestNameFilter property" {
$p.TestNameFilter | should -be "filter"
}... |
combined_dataset/train/non-malicious/Automount new PSDrives.ps1 | Automount new PSDrives.ps1 | # AutoMount.psm1 v1.0
# Oisin "x0n" Grehan (MVP)
$query = new-object System.Management.WqlEventQuery
$query.EventClassName = "__InstanceOperationEvent"
# default to every 2 seconds
$query.WithinInterval = new-object System.TimeSpan 0,0,2
@@# this WMI is only available with Windows 200... |
combined_dataset/train/non-malicious/sample_17_1.ps1 | sample_17_1.ps1 | Param(
[Parameter(Mandatory=$True,Position=0)]
[string]$ScriptPath,
[Parameter(Mandatory=$False)]
[switch]$IsAdminPrivlegeRequired,
[Parameter(Mandatory=$False)]
[string]$Arguments=""
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
# Event variable initialization
Set-Variable... |
combined_dataset/train/non-malicious/Update-DeptGPOs.ps1 | Update-DeptGPOs.ps1 | <#
.SYNOPSIS
Update permissions on Departmental GPO's
.DESCRIPTION
This script will backup all existing GPO's in the domain prior to making any changes. After the backup
has been made Departmental GPOs will be updated based on their Dept Code.
.PARAMETER DeptCode
A cod... |
combined_dataset/train/non-malicious/1655.ps1 | 1655.ps1 |
$path = 'C:\temp\'
$a1 = New-Object System.Collections.ArrayList
$a2 = New-Object System.Collections.ArrayList
$a3 = New-Object System.Collections.ArrayList
$a4 = New-Object System.Collections.ArrayList
$a5 = New-Object System.Collections.ArrayList
$null = 1..3 | % {
$a1.Add(
(Measure-Command {
... |
combined_dataset/train/non-malicious/sample_18_99.ps1 | sample_18_99.ps1 | @{
GUID="56D66100-99A0-4FFC-A12D-EEE9A6718AEF"
Author="PowerShell"
CompanyName="Microsoft Corporation"
Copyright="Copyright (c) Microsoft Corporation."
ModuleVersion="7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion="3.0"
FunctionsToExport = @()
CmdletsToExport="Start-Transcript", "Stop-Transcript"
AliasesTo... |
combined_dataset/train/non-malicious/sample_25_19.ps1 | sample_25_19.ps1 | aΟ περιορισμός PrintAllTranslations δεν μπορεί να χρησιμοποιηθεί με περιορισμό IgnoreTranslations. Δεν μπορείτε να προσθέσετε την υπολογιζόμενη στήλη "%{ccon_column/}" στον υβριδικό πίνακα "%{ccon_table/}". Παρακαλώ καταργήστε την υπολογιζόμενη στήλη.¢Δεν μπορείτε να προσθέσετε μια στήλη "alternateOf" που χρησιμοποιεί... |
combined_dataset/train/non-malicious/Get-Tree_1.ps1 | Get-Tree_1.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/Get-InstalledProgram_v_2.ps1 | Get-InstalledProgram_v_2.ps1 | function Get-InstalledProgram() {
param (
[String[]]$Computer,
$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 {$_.vendor -notlike ... |
combined_dataset/train/non-malicious/sample_21_21.ps1 | sample_21_21.ps1 |
if($debug -eq $true){[void]$shell.popup("Run DC_FCInfo.ps1")}
if ($OSArchitecture -eq 'ARM')
{
'Skipping running {fcinfo.exe} since it is not supported in ' + $OSArchitecture + ' architecture.' | WriteTo-StdOut
return
}
Import-LocalizedData -BindingVariable FCInfoStrings
Write-DiagProgress -Activity $FCIn... |
combined_dataset/train/non-malicious/sample_25_79.ps1 | sample_25_79.ps1 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
@{
RootModule = './Microsoft.PowerShell.PSResourceGet.dll'
NestedModules = @('./Microsoft.PowerShell.PSResourceGet.psm1')
ModuleVersion = '1.0.4.1'
CompatiblePSEditions =... |
combined_dataset/train/non-malicious/New-ZipFile.ps1 | New-ZipFile.ps1 | ##############################################################################\n##\n## New-ZipFile\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 a Zip... |
combined_dataset/train/non-malicious/1942.ps1 | 1942.ps1 |
Describe "Get-Member" -Tags "CI" {
It "Should be able to be called on string objects, ints, arrays, etc" {
$a = 1
$b = 1.3
$c = $false
$d = @(1, 3)
$e = "anoeduntodeu"
$f = 'asntoheusth'
Get-Member -InputObject $a | Should -Not -BeNullOrEmpty
G... |
combined_dataset/train/non-malicious/1540.ps1 | 1540.ps1 | function Expand-MrZipFile {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true,
ValueFromPipeline=$true)]
[ValidateScript({
If ((Test-Path -Path $_ -PathType Leaf) -and ($_ -like "*.zip")) {
$true
}
else {
... |
combined_dataset/train/non-malicious/Set-PrimaryDnsSuffix_1.ps1 | Set-PrimaryDnsSuffix_1.ps1 | function Set-PrimaryDnsSuffix {
param ([string] $Suffix)
# http://msdn.microsoft.com/en-us/library/ms724224(v=vs.85).aspx
$ComputerNamePhysicalDnsDomain = 6
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
namespace ComputerSystem {
public class Identification ... |
combined_dataset/train/non-malicious/sample_49_13.ps1 | sample_49_13.ps1 | "IDS_ACCESS_ACCESSCONTROL_CAPTION" = "Kiểm soát Truy cập";
"IDS_ACCESS_CONTROLTYPE_CONFIRMALL" = "Xác nhận tất cả";
"IDS_ACCESS_CONTROLTYPE_FULLACCESS" = "Truy cập toàn bộ";
"IDS_ACCESS_CONTROLTYPE_MEETING_DENY" = "Từ chối buổi họp";
"IDS_ACCESS_CONTROLTYPE_VIEWANDSHOW" = "Xem và hiển thị";
"IDS_ACCESS... |
combined_dataset/train/non-malicious/sample_24_45.ps1 | sample_24_45.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/Get-RelativePath.ps1 | Get-RelativePath.ps1 | function Get-RelativePath {
<#
.SYNOPSIS
Get a path to a file (or folder) relative to another folder
.DESCRIPTION
Converts the FilePath to a relative path rooted in the specified Folder
.PARAMETER Folder
The folder to build a relative path from
.PARAMETER FilePath
The File (or folder) to build a re... |
combined_dataset/train/non-malicious/1554.ps1 | 1554.ps1 |
function Set-MrInternetConnectionSharing {
[CmdletBinding()]
param (
[Parameter(Mandatory,
ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[ValidateScript({
If ((Get-NetAdapter -Name $_ -ErrorAction SilentlyContinue -OutVariable INetNIC)... |
combined_dataset/train/non-malicious/sample_44_75.ps1 | sample_44_75.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function Find-Ast {
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
[CmdletBinding(PositionalBinding=$false, DefaultParameterSetName='FilterScript')]
param(
[Parameter(Position=0, ParameterSe... |
combined_dataset/train/non-malicious/sample_7_64.ps1 | sample_7_64.ps1 | param(
[string]$DataPath,
[switch]$AcceptEula,
[switch]$Logs,
[switch]$Trace,
[string]$StartAt,
[string]$Duration,
[switch]$Auth
)
$version = "Sched-Collect (20231031)"
<#
Created by Gianni Bragante - gbrag@microsoft.com
Updates:
2023-10-31 Marius Porcolean (maporcol@microsoft... |
combined_dataset/train/non-malicious/sample_22_70.ps1 | sample_22_70.ps1 | <#############################################################
# #
# Copyright (C) Microsoft Corporation. All rights reserved. #
# #
#############################################################>
... |
combined_dataset/train/non-malicious/3030.ps1 | 3030.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "Should -Throw" {
Context "Basic functionality" {
It "given scriptblock that throws an exception it passes" {
{ throw } | Should -Throw
}
It "given scriptblock that throws an exception is pas... |
combined_dataset/train/non-malicious/sample_28_80.ps1 | sample_28_80.ps1 | function Search-AzDataProtectionBackupVaultInAzGraph
{
[OutputType('PSObject')]
[CmdletBinding(PositionalBinding=$false)]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Description('Searches for Backup vaults in Azure Resource Graph and retrieves the expected entries')]
param (
[Par... |
combined_dataset/train/non-malicious/sample_42_43.ps1 | sample_42_43.ps1 | # Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved.
Function Enter-AmtRemoteConfiguration {
<#
.Synopsis
Enters a Remote Configuration Session with an Intel Active Management Technology client
.Description
The Enter-AmtRemoteConfiguration Cmdlet starts an interactive configuration ... |
combined_dataset/train/non-malicious/VM Performance Report_4.ps1 | VM Performance Report_4.ps1 | <#
.SYNOPSIS
The script creates an HTML report for given vSphere VM's, that contains VM performance data over a given period. The script then emails the report to a given address.
.DESCRIPTION
The script requires an input file, supplied as an argument to the script. The first line of this file contains an e... |
combined_dataset/train/non-malicious/sample_65_41.ps1 | sample_65_41.ps1 |
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# 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 License at
# http://www.apa... |
combined_dataset/train/non-malicious/sample_47_67.ps1 | sample_47_67.ps1 | #
# Module manifest for module 'OCI.PSModules.Filestorage'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Filestorage.dll'
# Version number of this module.
ModuleVersion = '83.1.0'
# Supported PSEdition... |
combined_dataset/train/non-malicious/sample_63_84.ps1 | sample_63_84.ps1 |
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# 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 License at
# http://www.apa... |
combined_dataset/train/non-malicious/459.ps1 | 459.ps1 | Set-PSFConfig -Module PSFramework -Name 'Utility.Size.Style' -Value ([PSFramework.Utility.SizeStyle]::Dynamic) -Initialize -Validation sizestyle -Handler { [PSFramework.Utility.UtilityHost]::SizeStyle = $args[0] } -Description "Controls how size objects are displayed by default. Generally, their string representation i... |
combined_dataset/train/non-malicious/sample_59_64.ps1 | sample_59_64.ps1 | <#############################################################
# #
# Copyright (C) Microsoft Corporation. All rights reserved. #
# #
#############################################################>
... |
combined_dataset/train/non-malicious/Find-GeoCode.ps1 | Find-GeoCode.ps1 | $mappoint = New-WebServiceProxy http://staging.mappoint.net/standard-30/mappoint.wsdl -Namespace MapPoint
$FindService = new-object MapPoint.FindServiceSoap
# You need an account, sign up here: https://mappoint-css.live.com/mwssignup
$FindService.Credentials = Get-Credential
function Find-ReverseGeoCode( [double... |
combined_dataset/train/non-malicious/4208.ps1 | 4208.ps1 |
Function Brute-LocAdmin
{
param($Username)
Function Test-LocAdminCred
{
Param($username, $password)
$computer = $env:COMPUTERNAME
Add-Type -assemblyname System.DirectoryServices.AccountManagement
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.Direct... |
combined_dataset/train/non-malicious/Invoke-ScriptBlock.ps1 | Invoke-ScriptBlock.ps1 | ##############################################################################\n##\n## Invoke-ScriptBlock\n##\n## From Windows PowerShell, The Definitive Guide (O'Reilly)\n## by Lee Holmes (http://www.leeholmes.com/guide)\n##\n##############################################################################\n\n<#\n\n.SYNO... |
combined_dataset/train/non-malicious/sample_49_75.ps1 | sample_49_75.ps1 | #
# Module manifest for module 'OCI.PSModules.Audit'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Audit.dll'
# Version number of this module.
ModuleVersion = '74.1.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/2533.ps1 | 2533.ps1 | param($fileFilter=$(throw "Filter must be specified"))
$regex = [regex]"^(?<Program>\S*)\s*pid: (?<PID>\d*)\s*type: (?<Handle>\S*)\s*\w*: (?<File>((\\\\).*|([a-zA-Z]:).*))"
E:\Dexma\bin\ThirdParty\handle $fileFilter | Get-Matches -Pattern $regex
|
combined_dataset/train/non-malicious/sample_55_95.ps1 | sample_55_95.ps1 | #
# Module manifest for module 'OCI.PSModules.Identitydomains'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Identitydomains.dll'
# Version number of this module.
ModuleVersion = '84.0.0'
# Supported P... |
combined_dataset/train/non-malicious/3034.ps1 | 3034.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "Should -Exist" {
It "returns true for paths that exist" {
$TestDrive | Should Exist
$TestDrive | Should -Exist
}
It "returns false for paths do not exist" {
"$TestDrive\nonexistant" | Should... |
combined_dataset/train/non-malicious/3374.ps1 | 3374.ps1 | $mapping = [ordered]@{}
$psd1s = Get-ChildItem -Path $PSScriptRoot/../src -Recurse | `
Where-Object {($_.Name -like "*AzureRM*psd1" -or $_.Name -eq "Azure.AnalysisServices.psd1" -or $_.Name -eq "Azure.Storage.psd1") `
-and $_.FullName -notlike "*Stack*" -and $_.FullName -notlike "*`\Package`\*" -and $_.FullNa... |
combined_dataset/train/non-malicious/sample_30_33.ps1 | sample_30_33.ps1 | $osInfo = Get-WmiObject -Class Win32_OperatingSystem
# check if running on Windows Server
if ($osInfo.ProductType -eq 3) {
Install-WindowsFeature Server-Media-Foundation
}
# SIG # Begin signature block
# MIInvgYJKoZIhvcNAQcCoIInrzCCJ6sCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwE... |
combined_dataset/train/non-malicious/Exch07 Quota Report.ps1 | Exch07 Quota Report.ps1 | #Get information on everybodies inbox and spit it out with total sizes #in MB. Sorts the list by StorageLimitStatus
#NOTE THAT I HAD TO USE ASCII WITH OUT-FILE AS NO OTHER ENCODING WOULD #PROPERLY IMPORT CSV INTO EXCEL
#create a date var to stick in the filename
$date = get-date -Format MM-dd-yyyy
#create a ou... |
combined_dataset/train/non-malicious/Write-FileInfoToSQL.ps1 | Write-FileInfoToSQL.ps1 | # ---------------------------------------------------------------------------
### <Script>
### <Author>
### Chad Miller
### </Author>
### <Description>
### Reports data model directories and bool value as to whether they have
### an htm file of the same name as the project directory.
### </Description>
### <U... |
combined_dataset/train/non-malicious/sample_14_89.ps1 | sample_14_89.ps1 |
function Deploy-Dependencies {
param (
[string] $deploy_directory
)
Write-Host "Copying libva runtime and driver at:"
Get-Date
# Copy the VA runtime binaries from the mesa built dependencies so the versions match with the built mesa VA driver binary
$depsInstallPath="C:\mesa-deps"
Copy-Item "$dep... |
combined_dataset/train/non-malicious/CreateVDS_1.ps1 | CreateVDS_1.ps1 | function CreateVDS(
$vdsName, $datacenter, $vmHost, $physicalNic, $portGroupType = "earlyBinding", `
[array]$portGroupNameList = @(),[array]$uplinkList = @() ) {
# ------- Create vDS ------- #
$vdsCreateSpec = New-Object VMware.Vim.DVSCreateSpec
$vdsCreateSpec.configSpec = New-Object VMware.V... |
combined_dataset/train/non-malicious/963.ps1 | 963.ps1 |
$rgName='MyResourceGroup'
$location='eastus'
$cred = Get-Credential -Message 'Enter a username and password for the virtual machine.'
New-AzResourceGroup -Name $rgName -Location $location
$fesubnet = New-AzVirtualNetworkSubnetConfig -Name 'MySubnet-FrontEnd' -AddressPrefix '10.0.1.0/24'
$besubnet = New-AzVirtual... |
combined_dataset/train/non-malicious/GeSHi PowerShell Syntax .ps1 | GeSHi PowerShell Syntax .ps1 | <?php
/*************************************************************************************
* posh.php
* ---------------------------------
* Author: Joel Bennett (Jaykul@HuddledMasses.org)
* Copyright: (c) 2007 Joel Bennett (http://HuddledMasses.org/)
* Release Version: 1.1.0
* Date Started: 2007-06-08
... |
combined_dataset/train/non-malicious/2636.ps1 | 2636.ps1 | function New-LabVM{
param([string]$VMName
,[string]$VMPath
,[string]$VHDPath
,[string[]]$VMSwitches
,[string[]]$ISOs
,[string]$VMSource
,[Parameter(Mandatory=$true)][System.Management.Automation.PSCredential]$LocalCred
)
try{
$VHDFile = Join-Path -... |
combined_dataset/train/non-malicious/sample_2_73.ps1 | sample_2_73.ps1 | #************************************************
# Gather_Secure_Channel_Info.ps1
# Version 1.1
# Date: 3-30-2012
# Author: Tim Springston
# Description: This script queries the currently cached
# secure channel information for a domain member
# or domain controller.
# -Added lo... |
combined_dataset/train/non-malicious/sample_58_41.ps1 | sample_58_41.ps1 | <Configuration>
<ViewDefinitions>
<View>
<Name>PSReadLine-KeyBindings</Name>
<ViewSelectedBy>
<TypeName>Microsoft.PowerShell.KeyHandler</TypeName>
</ViewSelectedBy>
<GroupBy>
<PropertyName>Group</PropertyName>
<CustomControl>
<CustomEntries>
... |
combined_dataset/train/non-malicious/Help Differ 10000 v_1.01.ps1 | Help Differ 10000 v_1.01.ps1 | # These functions are meant to help generate a table that shows differences between
# cmdlets among different versions of a module.
# You will need a MoinMoin wiki to render the output.
# If you don't have a MoinMoin wiki you might be able to use the sandbox at http://moinmo.in/WikiSandBox
# Extracts some data fr... |
combined_dataset/train/non-malicious/sample_17_21.ps1 | sample_17_21.ps1 | #
# Module manifest for module 'OCI.PSModules.Computeinstanceagent'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Computeinstanceagent.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.