full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/685.ps1 | 685.ps1 |
function Set-RsDatabaseCredentials
{
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
param(
[Parameter(Mandatory = $true)]
[Alias('Authentication')]
[Microsoft.ReportingServicesTools.SqlServerAuthenticationType]
$DatabaseCredentialType,
[Sy... |
combined_dataset/train/non-malicious/sample_64_40.ps1 | sample_64_40.ps1 | data LocalizedData
{
# culture="en-US"
ConvertFrom-StringData @'
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 directory path.
InvalidZipFileExtensionError={0} is not a su... |
combined_dataset/train/non-malicious/1844.ps1 | 1844.ps1 |
Describe 'Get-WinEvent' -Tags "CI" {
BeforeAll {
if ( ! $IsWindows )
{
$origDefaults = $PSDefaultParameterValues.Clone()
$PSDefaultParameterValues['it:skip'] = $true
}
}
AfterAll {
if ( ! $IsWindows ){
$global:PSDefaultParameterValues = $... |
combined_dataset/train/non-malicious/sample_28_37.ps1 | sample_28_37.ps1 | # region Generated
# Load the private module dll
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Aks.private.dll')
# Load the internal module
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Aks.internal.psm1'
if(Test-Path $internalModulePath) {
$null = Impo... |
combined_dataset/train/non-malicious/450.ps1 | 450.ps1 | Register-PSFConfigValidation -Name "integer" -ScriptBlock {
Param (
$Value
)
$Result = New-Object PSOBject -Property @{
Success = $True
Value = $null
Message = ""
}
try { [int]$number = $Value }
catch
{
$Result.Message = "Not an integer: $Value"
$Result.Success = $False
return $Result
}
$Re... |
combined_dataset/train/non-malicious/sample_34_29.ps1 | sample_34_29.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/2034.ps1 | 2034.ps1 |
Describe "Verify approved aliases list" -Tags "CI" {
BeforeAll {
$FullCLR = !$isCoreCLR
$CoreWindows = $isCoreCLR -and $IsWindows
$CoreUnix = $isCoreCLR -and !$IsWindows
$isPreview = $PSVersionTable.GitCommitId.Contains("preview")
if ($IsWindows) {
$configPath =... |
combined_dataset/train/non-malicious/2374.ps1 | 2374.ps1 | function Copy-FileWithHashCheck {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, ValueFromPipeline = $True)]
[Alias('Fullname')]
[string]$SourceFilePath,
[Parameter(Mandatory = $true)]
[ValidateScript({ Test-Path -Path $_ -PathType Container })]
[string]... |
combined_dataset/train/non-malicious/sample_53_21.ps1 | sample_53_21.ps1 | # Copyright (C) Microsoft Corporation. All rights reserved.
# -------------------------------------------------------------------------------------------------
# This script provides users the ability to download and launch different verision of native host.
# It removes any exisiting version of outlook on the use... |
combined_dataset/train/non-malicious/974.ps1 | 974.ps1 |
$SubscriptionId = ''
$sourceResourceGroupName = "mySourceResourceGroup-$(Get-Random)"
$sourceResourceGroupLocation = "westus2"
$targetResourceGroupname = "myTargetResourceGroup-$(Get-Random)"
$targetResourceGroupLocation = "eastus"
$adminSqlLogin = "SqlAdmin"
$password = "ChangeYourAdminPassword1"
$sourceServerNa... |
combined_dataset/train/non-malicious/sample_55_30.ps1 | sample_55_30.ps1 | #
# Module manifest for module 'OCI.PSModules.Ailanguage'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Ailanguage.dll'
# Version number of this module.
ModuleVersion = '86.0.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/sample_36_48.ps1 | sample_36_48.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_14_84.ps1 | sample_14_84.ps1 | <#
Returns a certificate object that meets the following conditions:
- Located in LocalMachine\TrustedPeople store
- Subject is for the given computer name
- Not expired
- Has a private key
#>
function Find-TrustedCertificate([string] $ComputerName)
{
$result = $null
... |
combined_dataset/train/non-malicious/Get-2011SGScriptingScore.ps1 | Get-2011SGScriptingScore.ps1 | Function Get-2011SGScriptingScore ([Parameter(Mandatory=$True)][STRING]$Contestant) {
$WebClient = New-Object System.Net.WebClient
$Results = $WebClient.DownloadString("https://2011sg.poshcode.org/Reports/TopUsers?filter=Beginner")+$WebClient.DownloadString
("https://2011sg.poshcode.org/Reports/TopUsers?... |
combined_dataset/train/non-malicious/Set vSphere CDP LinkDisc_1.ps1 | Set vSphere CDP LinkDisc_1.ps1 | function set-vSwitchLinkDiscovery {
Param (
#Switch to enable vSwitch Discovery On
[Parameter(Mandatory=$true,ValueFromPipeline=$true)] [string] $vSwitchName = "vSwitch0",
#Host on which the vSwitch Resides
[Parameter(Mandatory=$true,HelpMessage="Need Host Name to connect with")... |
combined_dataset/train/non-malicious/sample_18_78.ps1 | sample_18_78.ps1 | Set-StrictMode -Version Latest
Import-Module (Join-Path $PSScriptRoot "Events.psm1")
Write-EventLog @EVL_CURTAINAPP -Message "Launching CurtainApp"
& $PSScriptRoot\CurtainApp\CurtainApp.exe --timeout 300 --mode "outofpackage"
& $Env:SystemDrive\Rigel\x64\Scripts\Provisioning\ScriptLaunch.ps1 ApplyConfig.ps1 -... |
combined_dataset/train/non-malicious/2387.ps1 | 2387.ps1 | $Folder1Path = 'C:\Folder1'
$Folder2Path = 'C:\Folder2'
$Folder1Files = Get-ChildItem -Path $Folder1Path
$Folder2Files = Get-ChildItem -Path $Folder2Path
$FileDiffs = Compare-Object -ReferenceObject $Folder1Files -DifferenceObject $Folder2Files
$FileDiffs | foreach {
$removeParams = @{
'Path' = $_.InputObject.Ful... |
combined_dataset/train/non-malicious/Add-SqlTable_6.ps1 | Add-SqlTable_6.ps1 | try {add-type -AssemblyName "Microsoft.SqlServer.ConnectionInfo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" -EA Stop}
catch {add-type -AssemblyName "Microsoft.SqlServer.ConnectionInfo"}
try {add-type -AssemblyName "Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8... |
combined_dataset/train/non-malicious/PSTUtility_1.psm1.ps1 | PSTUtility_1.psm1.ps1 | #=============================================================================
#
# PST Utilities - For Discovery, Import, Removal
#
# Dan Thompson
# dethompson71 at live dot com
#
# This collection of tools for importing PSTs has been pieced together
# over many months of trial and error.
#
# Goal is to get ... |
combined_dataset/train/non-malicious/sample_35_64.ps1 | sample_35_64.ps1 | #
# Script module for module 'Az.ApiManagement' that is executed when 'Az.ApiManagement' is imported in a PowerShell session.
#
# Generated by: Microsoft Corporation
#
# Generated on: 05/16/2024 06:33:06
#
$PSDefaultParameterValues.Clear()
Set-StrictMode -Version Latest
function Test-DotNet
{
try
... |
combined_dataset/train/non-malicious/sample_6_68.ps1 | sample_6_68.ps1 | #************************************************
# DC_ServerManagerLogs.ps1
# Version 1.0.1
# Date: 01-04-2011
# Author: Andre Teixeira - andret@microsoft.com
# Description: This script can be used to obtain server manager related logs
#************************************************
PARAM($MachineName=$Comp... |
combined_dataset/train/non-malicious/1699.ps1 | 1699.ps1 | [CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullorEmpty()]
[PSCredential]$Credential
)
If (-not $PSScriptRoot) {$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent}
$Script:ThisCommand = $MyInvocation.MyCommand
$ProjectRoot = Resolve-Path "$PSScriptRoot\.."
$ModuleRoot ... |
combined_dataset/train/non-malicious/sample_35_3.ps1 | sample_35_3.ps1 | #
# Module manifest for module 'OCI.PSModules.Vulnerabilityscanning'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Vulnerabilityscanning.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
#... |
combined_dataset/train/non-malicious/2616.ps1 | 2616.ps1 | function New-MSFLabImage{
[CmdletBinding()]
param([string]$ISO
,[string]$OutputPath
,[string]$ImageName
,[string]$Edition
,[string]$UnattendXML
,[string[]]$CustomModules
)
$ErrorActionPreference = 'Stop'
. C:\git-repositories\PowerShell\Convert-WindowsImage.ps1
Write-Verbose "Validating Bui... |
combined_dataset/train/non-malicious/Magister SOAP Webrequest.ps1 | Magister SOAP Webrequest.ps1 |
# Execute-MagisterSOAP.ps1
# We are reading a list of students from a Magister SOAP webrequest.
# 20120330
# Paul Wiegmans
Clear
Set-StrictMode -Version 2
$mijnpad = Split-Path -parent $MyInvocation.MyCommand.Definition
Echo "Mijn pad is: $mijnpad "
# This is the Magister webquery URL
$layout = "Basis"
$u... |
combined_dataset/train/non-malicious/sample_59_24.ps1 | sample_59_24.ps1 | @{
GUID="eb74e8da-9ae2-482a-a648-e96550fb8733"
Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="© Microsoft Corporation. All rights reserved."
Description='PowerShell module for working with ZIP archives.'
ModuleVersion="1.2.5"
PowerShellVersion="3.0"
FunctionsToExport = @('Compress... |
combined_dataset/train/non-malicious/Get-RemoteRegistry_1.ps1 | Get-RemoteRegistry_1.ps1 | ## Get-RemoteRegistry
########################################################################################
## Version: 2.0
## + I added the "Properties" parameter so you can select specific registry values
## NOTE: you have to have access, and the remote registry service has to be running
####################... |
combined_dataset/train/non-malicious/Get-WebFile 3.1.ps1 | Get-WebFile 3.1.ps1 | ## Get-WebFile.ps1 (aka wget for PowerShell)
##############################################################################################################
## Downloads a file or page from the web
## History:
## v3.1 - Unwrap the filename when it has quotes around it
## v3 - rewritten completely using HttpWebReq... |
combined_dataset/train/non-malicious/New-ObjectRecursive_1.ps1 | New-ObjectRecursive_1.ps1 | <#
.Synopsis
Creates new object based on hashtable definition
.Description
Function is wrapper for New-Object that allows user to create nested objects using nested hashtable as definition.
If you want to take advantage of type use 'Type' key within hashtable that defines object.
... |
combined_dataset/train/non-malicious/Send-FTP 1.0.ps1 | Send-FTP 1.0.ps1 | function Send-FTP {
Param(
$Server = "ilncenter.net"
, $Credentials = $(Get-Credential)
, [Parameter(ValueFromPipeline=$true)]
$LocalFile
, $Path = "/"
, $RemoteFile = $(Split-Path $LocalFile -Leaf)
, $ParentProgressId = -1 ## Just ignore this ;)
... |
combined_dataset/train/non-malicious/Get-Entropy_1.ps1 | Get-Entropy_1.ps1 | ##
function Get-Entropy
{
<#
.SYNOPSIS
Calculate the entropy of a byte array.
Author: Matthew Graeber (@mattifestation)
.PARAMETER ByteArray
Specifies the byte array containing the data from which entropy will be calculated.
.EXAMPLE
C:\\PS> $RandArray = New-Object Byte[](10000)
... |
combined_dataset/train/non-malicious/3340.ps1 | 3340.ps1 |
function Get-Group {
[PoshBot.BotCommand(
Aliases = ('gg', 'getgroup'),
Permissions = 'view-group'
)]
[cmdletbinding()]
param(
[parameter(Mandatory)]
$Bot,
[parameter(Position = 0)]
[string]$Name
)
if ($PSBoundParameters.ContainsKey('Name')... |
combined_dataset/train/non-malicious/3801.ps1 | 3801.ps1 |
function Test-NoWaitParameter
{
$rgname = Get-ComputeTestResourceName
try
{
$loc = Get-ComputeVMLocation;
New-AzResourceGroup -Name $rgname -Location $loc -Force;
$vmname = 'vm' + $rgname;
$user = "Foo12";
$password = $PLACEHOLDER;
$se... |
combined_dataset/train/non-malicious/sample_6_76.ps1 | sample_6_76.ps1 | #************************************************
# DC_COMCollect.ps1
# Version 1.0
# Date: 2009-2019
# Author: Walter Eder (waltere@microsoft.com)
# Description: Collects .Net Framework nGen files
# Called from: TS_AutoAddCommands_Apps.ps1
#*******************************************************
Trap [Except... |
combined_dataset/train/non-malicious/sample_54_31.ps1 | sample_54_31.ps1 | Import-LocalizedData -BindingVariable lnTxt -FileName AzStackHci.ClusterWitness.Strings.psd1
function Test-WitnessFileShareWithCredential
{
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, HelpMessage="Witness file share path.")]
[ValidateNotNullOrEmpty()]
[String]
... |
combined_dataset/train/non-malicious/sample_50_11.ps1 | sample_50_11.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 = '83.2.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/sample_61_63.ps1 | sample_61_63.ps1 | # ------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
# ------------------------------------------------------------
function Unpublish-ServiceFab... |
combined_dataset/train/non-malicious/Get-DefragAnalysis.ps1 | Get-DefragAnalysis.ps1 | # defrag_analysis.ps1
#
# Displays Defrag Analysis Info for a remote server.
#
# Author: tojo2000@tojo2000.com
Set-PSDebug -Strict`
trap [Exception] {
continue
}
function GenerateForm {
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
[reflection.assembly]::loadwithpartialname(... |
combined_dataset/train/non-malicious/3048.ps1 | 3048.ps1 | function Should-FileContentMatchMultiline($ActualValue, $ExpectedContent, [switch] $Negate, [String] $Because) {
$succeeded = [bool] ((& $SafeCommands['Get-Content'] $ActualValue -Delimiter ([char]0)) -match $ExpectedContent)
if ($Negate) {
$succeeded = -not $succeeded
}
$failureMessage =... |
combined_dataset/train/non-malicious/Resolve-Url.ps1 | Resolve-Url.ps1 | ###################################
## Figure out the real url behind those shortened forms
function Resolve-URL([string[]]$urls) {
[regex]$snip = "(?:https?://)?(?:snurl|snipr|snipurl)\\.com/([^?/ ]*)\\b"
[regex]$tiny = "(?:https?://)?TinyURL.com/([^?/ ]*)\\b"
[regex]$isgd = "(?:https?://)?is.gd/([^?... |
combined_dataset/train/non-malicious/sample_3_92.ps1 | sample_3_92.ps1 | #
# Module manifest for module 'OCI.PSModules.Common'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Common.dll'
# Version number of this module.
ModuleVersion = '92.1.0'
# Supported PSEditions
Compatib... |
combined_dataset/train/non-malicious/sample_19_96.ps1 | sample_19_96.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 = '73.1.0'
#... |
combined_dataset/train/non-malicious/AddTo-HostsFile_1.ps1 | AddTo-HostsFile_1.ps1 | function AddTo-HostsFile{
<#
.DESCRIPTION
This function checks to see if an entry exists in the hosts file.
If it does not, it attempts to add it and verifies the entry.
.EXAMPLE
Networkign.AddTo-Hosts -IPAddress 192.168.0.1 -HostName MyMachine
.EXTERNALHELP
None.
.FORWARDHELPTARGE... |
combined_dataset/train/non-malicious/2613.ps1 | 2613.ps1 |
Import-Module C:\git-repositories\PowerShell\MSFVMLab\MSFVMLab.psm1 -Force
$LabConfig = Get-Content C:\git-repositories\PowerShell\MSFVMLab\LabVMS.json | ConvertFrom-Json
$WorkingDirectory = $LabConfig.WorkingDirectory
If(-not (Test-Path $WorkingDirectory)){
Write-Error "$WorkingDirectory does not exist!" -Erro... |
combined_dataset/train/non-malicious/Get-Field_2.ps1 | Get-Field_2.ps1 | function Get-Field{
[CmdletBinding()]
param (
[Parameter(Position=0,Mandatory=$true,ValueFromPipeline=$true)]
$InputObject,
[Parameter(Position=1,Mandatory=$false)]
[string]$Name,
[switch]$Force,
[switch]$AsHashtable
)
$publicNonPublic = [Reflection.BindingFlags]::Public -bor [Reflection... |
combined_dataset/train/non-malicious/Get-PDC09Videos.ps1 | Get-PDC09Videos.ps1 | #requires -version 2.0
PARAM (
[Parameter(Position=1, Mandatory=$true)]
[ValidateSet("wmv","wmvhigh","ppt")] # the "mp4" files aren't there yet
[String]$MediaType,
[string]$Destination = $PWD
)
Import-Module BitsTransfer
$Extension = $(switch -wildcard($MediaType){"wmv*"{"wmv"} "mp4"{"mp4"} "pp... |
combined_dataset/train/non-malicious/255.ps1 | 255.ps1 | function Get-O365CalendarEvent
{
[CmdletBinding()]
param
(
[System.String]$EmailAddress,
[System.datetime]$StartDateTime = (Get-Date),
[System.datetime]$EndDateTime = ((Get-Date).adddays(7)),
[System.Management.Automation.Credential()]
[pscredential]
$Cre... |
combined_dataset/train/non-malicious/New-Shortcut_2.ps1 | New-Shortcut_2.ps1 | [CmdletBinding()]
param (
[parameter(Mandatory=$true)]
[ValidateScript( {[IO.File]::Exists($_)} )]
[System.IO.FileInfo] $Target,
[ValidateScript( {[IO.Directory]::Exists($_)} )]
[System.IO.DirectoryInfo] $OutputDirectory,
[string] $Name,
[string] $Description,
[string] $Arguments,
[System.I... |
combined_dataset/train/non-malicious/sample_4_10.ps1 | sample_4_10.ps1 | // Class: clpsvc1 => DCIM_CLPProvidesEndpoint => DCIM_CLPProtocolEndpoint
[dynamic, provider("dcismprovider")]
class DCIM_CLPProvidesEndpoint : CIM_ProvidesEndpoint
{ };
/* SIG # Begin signature block */
/* MIItDQYJKoZIhvcNAQcCoIIs/jCCLPoCAQExDzANBglghkgBZQMEAgEFADB5Bgor */
/* BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEe... |
combined_dataset/train/non-malicious/TabExpansion.ps1 | TabExpansion.ps1 | ## Tab-Completion
#################
## Please dot souce this script file.
## In first loading, it may take a several minutes, in order to generate ProgIDs and TypeNames list.
## What this can do is:
##
## [datetime]::n<tab>
## [datetime]::now.d<tab>
## $foo[0].<tab>
## $foo[0].n.b<tab>
## $function:a<tab>
##... |
combined_dataset/train/non-malicious/1631.ps1 | 1631.ps1 |
function Get-BitLockerInfo {
param (
[string]$ComputerName = $env:COMPUTERNAME,
[string]$PsExecPath = 'C:\pstools\psexec.exe'
)
if (Test-Connection -ComputerName $ComputerName -Quiet -Count 2) {
try{
$user = (Get-WmiObject -Class Win32_ComputerSystem -ComputerName... |
combined_dataset/train/non-malicious/2988.ps1 | 2988.ps1 | function Get-ShouldOperator {
[CmdletBinding()]
param ()
DynamicParam {
$ParameterName = 'Name'
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$AttributeCollection = New-Object System.Collections.Obje... |
combined_dataset/train/non-malicious/597.ps1 | 597.ps1 |
function Backup-AllSQLDBs{
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[String]
$Server = $env:COMPUTERNAME,
[Parameter(Mandatory=$true)]
[String]
$Instance,
[Parameter(Mandatory=$true)]
[String]
$Path
)
if((Get-PSSnapin "SqlServerCmdletSnapin100" -ErrorAction Si... |
combined_dataset/train/non-malicious/Is-Prime.ps1 | Is-Prime.ps1 | #########################################################################
#
# Is-Prime
#
#Written by Tynen
#
#########################################################################
function Is-Prime{
param ($number)
if($number -is [int] -or $number -is [long] -or $number -is [double] -or $number -is [sin... |
combined_dataset/train/non-malicious/sample_20_70.ps1 | sample_20_70.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 = '73.1.0'
# Supported P... |
combined_dataset/train/non-malicious/sample_23_96.ps1 | sample_23_96.ps1 | define({"orrespo":{"correspondência":[238,240,241,242,247,252,255,256,257,258,261,262,263,264,483,498,500,502,505],"corresponda":[240,303,579],"corresponde":[240,358,359,381,401,474,582,626],"correspondido":[240],"correspondam":[339,441],},"orrespon":{"correspondentes":[40,238,241,407,415,418,419,421,614],"corresponden... |
combined_dataset/train/non-malicious/sample_34_77.ps1 | sample_34_77.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 = '79.0.0'
# Supported PSEdition... |
combined_dataset/train/non-malicious/3706.ps1 | 3706.ps1 |
function Get-AzAdvisorConfigurationNoParameter
{
$propertiesCount = 4
$cmdletReturnType = "Microsoft.Azure.Commands.Advisor.Cmdlets.Models.PsAzureAdvisorConfigurationData"
$TypeValue = "Microsoft.Advisor/Configurations"
$queryResult = Get-AzAdvisorConfiguration
Assert-IsInstance $queryResult $c... |
combined_dataset/train/non-malicious/sample_29_94.ps1 | sample_29_94.ps1 | #
# Module manifest for module 'OCI.PSModules.Ocvp'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Ocvp.dll'
# Version number of this module.
ModuleVersion = '73.1.0'
# Supported PSEditions
CompatiblePS... |
combined_dataset/train/non-malicious/ShowUI Binary Clock.ps1 | ShowUI Binary Clock.ps1 | <#
.SYNOPSIS
Displays a Binary Coded Sexagesimal clock using the ShowUI module.
.DESCRIPTION
This clock displays time using three rows of blocks. The top row represents
hours, the middle is minutes and the bottom is seconds. Each of the six columns
represents a binary digit. The values for each digit in the ord... |
combined_dataset/train/non-malicious/New-StoredProcFunction.ps1 | New-StoredProcFunction.ps1 | # New-StoredProcFunction.ps1
# Steven Murawski
# http://blog.usepowershell.com
# 04/08/2009
# Example: ./New-StoredProcFunction.ps1 'DataSource=MySqlServer;Database=Northwind;User=AnythingButSa;Password=abc123' sp_createnewcustomer
# Example 'sp_createnewcustomer | ./New-StoredProcFunction.ps1 'DataSource=MySqlS... |
combined_dataset/train/non-malicious/Enable-HistoryPersistenc.ps1 | Enable-HistoryPersistenc.ps1 | ##############################################################################\n##\n## Enable-HistoryPersistence\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/26.ps1 | 26.ps1 | . $PSScriptRoot\Shared.ps1
function GetMacOSAdjustedTempPath($Path) {
if (($PSVersionTable.PSVersion.Major -ge 6) -and $IsMacOS) {
return "/private${Path}"
}
$Path
}
Describe 'Get-GitDiretory Tests' {
Context "Test normal repository" {
BeforeAll {
[System.Diagnost... |
combined_dataset/train/non-malicious/Add-Namespace_2.ps1 | Add-Namespace_2.ps1 | trap [System.Management.Automation.RuntimeException]
{
$entryException = $_
if ($_.CategoryInfo.Category -eq [System.Management.Automation.ErrorCategory]::InvalidOperation)
{
if ($_.FullyQualifiedErrorId -eq "TypeNotFound")
{
$targetName = $_.CategoryInfo.TargetName
... |
combined_dataset/train/non-malicious/sample_32_42.ps1 | sample_32_42.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/449.ps1 | 449.ps1 | Register-PSFConfigValidation -Name "timespan" -ScriptBlock {
Param (
$Value
)
$Result = New-Object PSObject -Property @{
Success = $True
Value = $null
Message = ""
}
try { [timespan]$timespan = $Value }
catch
{
$Result.Message = "Not a Timespan: $Value"
$Result.Success = $False
return $Result... |
combined_dataset/train/non-malicious/Get-MemoryChart.ps1 | Get-MemoryChart.ps1 | #.Synopsis
# Draw pie charts of server memory usage by process
#.Description
# Uses PowerBoots to draw a pipe-chart of each computer's memory use. While you wait for that information
# to be gathered, it shows you the latest xkcd comic. ##DEPEND-ON -Function Get-Comic
# Uses the Transitionals library for nic... |
combined_dataset/train/non-malicious/Get-ProfilesList_1.ps1 | Get-ProfilesList_1.ps1 | function Get-ProfilesList {
$hive = "HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList"
gci $hive | % -b {$prof = @()} -p {$dest = "" | select UserName, Sid, ProfilePath
$dest.Sid = $_.PSChildName
$dest.ProfilePath = (gp ($hive + "\\" + $_.PSChildName)).ProfileImagePath
$dest.Us... |
combined_dataset/train/non-malicious/891.ps1 | 891.ps1 | $webappname="mywebapp$(Get-Random -Minimum 100000 -Maximum 999999)"
$storagename="$($webappname)storage"
$container="appbackup"
$location="West Europe"
$backupname="backup1"
New-AzResourceGroup -Name myResourceGroup -Location $location
$storage = New-AzStorageAccount -ResourceGroupName myResourceGroup `
-Name $stor... |
combined_dataset/train/non-malicious/93a65603-30b1-4887-8fef-5b0d188f44a2.ps1 | 93a65603-30b1-4887-8fef-5b0d188f44a2.ps1 | function Using-Culture
{
<#
.SYNOPSIS
Runs a PowerShell script under a different locale to test localization features.
.DESCRIPTION
Runs a PowerShell script under a different locale to test localization features.
Copied from http://rkeithhill.wordpress.com/... |
combined_dataset/train/non-malicious/sample_36_38.ps1 | sample_36_38.ps1 | #!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
$pathsep=":"
$env_node_path=$env:NODE_PATH
$new_node_path="C:\practice\demo\quick-reference\node_modules\.pnpm\node_modules"
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux ... |
combined_dataset/train/non-malicious/sample_60_59.ps1 | sample_60_59.ps1 | #
# Module manifest for module 'OCI.PSModules.Database'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Database.dll'
# Version number of this module.
ModuleVersion = '89.0.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/Export-CustomProperty.ps1 | Export-CustomProperty.ps1 | ## An example of how to make a custom object with strongly-typed properties, custom enumeration values, and custom validators, etc.
function Export-CustomProperty {
param(
[Parameter(ValueFromPipeline=$true)]
[PSCustomObject]$Object
)
process {
foreach($property in Get-Member Get_*,Set_* -Input $Objec... |
combined_dataset/train/non-malicious/2269.ps1 | 2269.ps1 |
function Load-Form {
$Form.Controls.Add($TabControl)
$TabControl.Controls.AddRange(@($TabPageGeneral, $TabPageCAS, $TabPagePrimary, $TabPageSecondary, $TabPageSiteRoles, $TabPageOther))
$TabPageGeneral.Controls.AddRange(@($OutputBoxGeneral, $BlogLink, $LabelHeader, $LabelGeneralRestart, $LabelGener... |
combined_dataset/train/non-malicious/sample_3_12.ps1 | sample_3_12.ps1 | # You may use this code and information and create derivative works of it,
# provided that the following conditions are met:
# 1. This code and information and any derivative works may only be used for
# troubleshooting a) Windows and b) products for Windows, in either case using
# the Windows Troubleshooting Platf... |
combined_dataset/train/non-malicious/FastNFS - PowerCLI.ps1 | FastNFS - PowerCLI.ps1 | # fastNFS
# Description: Mounts NFS datastore to a group of ESX hosts.
# Usage: Enter a list of ESX hosts (by IP or hostname). Then enter the IP, path, and datastore name of the share.
#
#
# Enter the name or IP of the NFS server
$nfssrv = Read-Host "Enter the name or IP of the NFS server"
# Enter the full pa... |
combined_dataset/train/non-malicious/4416.ps1 | 4416.ps1 | function Update-Module {
[CmdletBinding(SupportsShouldProcess = $true,
HelpUri = 'https://go.microsoft.com/fwlink/?LinkID=398576')]
Param
(
[Parameter(ValueFromPipelineByPropertyName = $true,
Position = 0)]
[ValidateNotNullOrEmpty()]
[String[]]
$Name,... |
combined_dataset/train/non-malicious/Get-Weather_1.ps1 | Get-Weather_1.ps1 | Function Get-Weather {
<#
.SYNOPSIS
Display weather data for a specific country and city.
.DESCRIPTION
Display weather data for a specific country and city. There is a possibility for this to fail if the web service being used is unavailable.
.PARAMETER Country
URL of the website to test access to.... |
combined_dataset/train/non-malicious/770.ps1 | 770.ps1 |
[CmdletBinding(DefaultParameterSetName = "Build")]
param(
[Parameter(ParameterSetName="Bootstrap")]
[switch]
$Bootstrap,
[Parameter(ParameterSetName="Build")]
[switch]
$Clean,
[Parameter(ParameterSetName="Build")]
[switch]
$Test
)
$NeededTools = @{
VSCode = "Visual Studio ... |
combined_dataset/train/non-malicious/sample_50_17.ps1 | sample_50_17.ps1 | #
# Module manifest for module 'OCI.PSModules.Datalabelingservice'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Datalabelingservice.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Sup... |
combined_dataset/train/non-malicious/sample_39_35.ps1 | sample_39_35.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/2316.ps1 | 2316.ps1 | param(
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$CsvFilePath
)
function New-CompanyAdUser {
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[pscustomobject]$EmployeeRecord
)
$password = [System.Web.Security.Membership]::GeneratePassword((Get-Random -Minimum 20 -Maxi... |
combined_dataset/train/non-malicious/2848.ps1 | 2848.ps1 | function SelectObjectWithDefault
{
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline=$true)]
[PSObject]
$InputObject,
[string]
$Name,
$Value
)
process {
if ($_ -eq $null) { $Value }
elseif ($_ | Get-Member -Name $Name) {
$_.$... |
combined_dataset/train/non-malicious/Cisco-Inventory.ps1 | Cisco-Inventory.ps1 | #==================================================================================================
# File Name : CiscoInventory.ps1
# Original Author : Kenneth C. Mazie (kcmjr)
# Description : As written it will poll Cisco routers and switches and if the snmp OID's
# ... |
combined_dataset/train/non-malicious/Stop service and wait....ps1 | Stop service and wait....ps1 | <#
This script stops the service, then waits for the service to stop before continuing with the reboot/shutdown
The scritp can be pushed to a server/Pc using Group Policy or Registry or run manually.
The shutdown script Registry key is:
HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\State\\Ma... |
combined_dataset/train/non-malicious/sample_40_38.ps1 | sample_40_38.ps1 | # Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved.
Function Get-AMTFirmwareVersion {
<#
.Synopsis
Returns the core Intel Active Management Technology firmware version
.Description
This Cmdlet returns the Intel Active Management Technology(AMT) core firmware version from clients that... |
combined_dataset/train/non-malicious/sample_14_3.ps1 | sample_14_3.ps1 | #
# Module manifest for module 'OCI.PSModules.Logging'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Logging.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported PSEditions
Compat... |
combined_dataset/train/non-malicious/sample_59_41.ps1 | sample_59_41.ps1 | #
# Module manifest for module 'OCI.PSModules.Generativeai'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Generativeai.dll'
# Version number of this module.
ModuleVersion = '86.0.0'
# Supported PSEditi... |
combined_dataset/train/non-malicious/sample_42_84.ps1 | sample_42_84.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 = '83.1.0'
# Supported PSEditi... |
combined_dataset/train/non-malicious/Get-Parameter.ps1 | Get-Parameter.ps1 | param($Cmdlet) $CmdletInfo = Get-Command -CommandType Cmdlet -Name $Cmdlet
if ( $? ) {
if ($CmdletInfo.GetType().Name -eq "CmdletInfo" ) {
$parsed = $CmdletInfo.Definition `
-replace "\\] \\[", "]`n[" `
-replace "> \\[", ">`n[" `
-replace "$C... |
combined_dataset/train/non-malicious/image2excel_1.ps1 | image2excel_1.ps1 | <#
.Description
image2excel converts image to excel file
#>
param (
[parameter(Mandatory=$true,
ValueFromPipeline=$true,
HelpMessage="Image file path"
)]
[ValidateScript({Test-Path $_})]
[String]
$filename
)
[System.Reflect... |
combined_dataset/train/non-malicious/2054.ps1 | 2054.ps1 |
Import-Module HelpersCommon
Describe "Test-ModuleManifest tests" -tags "CI" {
BeforeEach {
$testModulePath = "testdrive:/module/test.psd1"
New-Item -ItemType Directory -Path testdrive:/module > $null
}
AfterEach {
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue testdr... |
combined_dataset/train/non-malicious/2570.ps1 | 2570.ps1 | param(
$SqlServerOne = 'YourDatabaseServer',
$FirstDatabase = 'FirstDatabaseToCompare',
$SqlServerTwo = 'YourDatabaseServer',
$SecondDatabase = 'SecondDatabaseToCompare',
[String[]] $DatabaseList,
$FilePrefix = 'Log',
[switch]$Log,
[switch]$Column
)
$File = $FilePrefix + '{0}-{1}.csv'
$ScriptName = [system... |
combined_dataset/train/non-malicious/796.ps1 | 796.ps1 | function My-Function ($myInput)
{
My-Function $myInput
}
$things = 4
$things
My-Function $things
Write-Output "Hi";
Write-Output ""
. .\VariableDefinition.ps1
Write-Output $variableInOtherFile
${variable-with-weird-name} = "this variable has special characters"
Write-Output ${variable-with-weird-name}
|
combined_dataset/train/non-malicious/Get-DLRestriction_1.ps1 | Get-DLRestriction_1.ps1 | ###########################################
# Get-DLRestriction
#
# Uses QAD cmdlets to retrieve distribution list restriction attributes
# and then provides a list of users which can send email messages to the group.
#
# Usage: Get-DLRestriction "Worldwide Everyone"
#
# Dmitry Sotnikov, http://dmitrysotnikov.... |
combined_dataset/train/non-malicious/sample_29_15.ps1 | sample_29_15.ps1 | if (
(Test-Path .web\bufferSource.ts) -and
(Test-Path .web\fetchSource.ts) -and
(Test-Path .web\extension.ts) -and
(Test-Path .web\package-lock.json) -and
(Test-Path .web\package.json) -and
(Test-Path .web\.vscode\extensions.json) -and
(Test-Path .web\.vscode\launch.json) -and
(T... |
combined_dataset/train/non-malicious/Get-QADGroupNesting.ps1 | Get-QADGroupNesting.ps1 | Param (
[Parameter(Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
HelpMessage="DN or ObjectGUID of the AD Group."
)]
[string]$groupIdentity,
[switch]$showTree
)
#Validate Quest PSSnapin is loaded
Add-PSSnapin -Name Quest.ActiveRoles.ADManagement -ErrorAction ... |
combined_dataset/train/non-malicious/1350.ps1 | 1350.ps1 |
function Remove-CIisMimeMap
{
[CmdletBinding(DefaultParameterSetName='ForWebServer')]
param(
[Parameter(Mandatory=$true,ParameterSetName='ForWebsite')]
[string]
$SiteName,
[Parameter(ParameterSetName='ForWebsite')]
[string]
$VirtualPath = ... |
combined_dataset/train/non-malicious/sample_57_7.ps1 | sample_57_7.ps1 | #
# Module manifest for module 'OCI.PSModules.Logging'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Logging.dll'
# Version number of this module.
ModuleVersion = '86.2.0'
# Supported PSEditions
Compat... |
combined_dataset/train/non-malicious/sample_35_72.ps1 | sample_35_72.ps1 | # Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved.
Function Invoke-VerifyDLLSign {
$CurrentDir = Split-Path -Parent $PSCommandPath
$DLLPath = Join-Path $CurrentDir Intel.Wsman.Scripting.dll
$sign = Get-AuthenticodeSignature $DLLPath
if ($sign.Status -ne "Valid")
{
Write-Error "Intel.Wsman.S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.