full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/4320.ps1 | 4320.ps1 |
function Test-EquivalentLocation {
[CmdletBinding()]
[OutputType("bool")]
param(
[Parameter(Mandatory = $false)]
[string]$LocationA,
[Parameter(Mandatory = $false)]
[string]$LocationB
)
$LocationA = $LocationA.TrimEnd("\/")
$LocationB = $LocationB.TrimEnd("\/... |
combined_dataset/train/non-malicious/sample_31_55.ps1 | sample_31_55.ps1 | @{
GUID="CA046F10-CA64-4740-8FF9-2565DBA61A4F"
Author="PowerShell"
CompanyName="Microsoft Corporation"
Copyright="Copyright (c) Microsoft Corporation."
ModuleVersion="7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion="3.0"
FunctionsToExport = @()
CmdletsToExport="Get-WinEvent", "New-WinEvent", "Get-C... |
combined_dataset/train/non-malicious/2016.ps1 | 2016.ps1 |
. "$psscriptroot/TestRunner.ps1"
$AssemblyName = "Microsoft.PowerShell.ConsoleHost"
$excludeList = @("HostMshSnapinResources.resx")
Test-ResourceStrings -AssemblyName $AssemblyName -ExcludeList $excludeList
|
combined_dataset/train/non-malicious/3091.ps1 | 3091.ps1 | function Verify-NotNull {
param (
[Parameter(ValueFromPipeline = $true)]
$Actual
)
if ($null -eq $Actual) {
throw [Exception]"Expected not `$null but got `$null."
}
$Actual
}
|
combined_dataset/train/non-malicious/3434.ps1 | 3434.ps1 |
Write-Output "JobId:$($PsPrivateMetaData.JobId.Guid)"
$VerbosePreference = 'Continue'
Login-AutomationConnection %LOGIN-PARAMS%
%TEST-LIST%
Run-Test $testList %LOGIN-PARAMS%
$azErrors = Resolve-AzError
$azErrors
Write-Verbose 'Resolve-AzError Information'
Write-Verbose '----------------------... |
combined_dataset/train/non-malicious/sample_2_57.ps1 | sample_2_57.ps1 | [ dynamic, provider("dcismprovider"),
Description(
"DCIM_NumericSensor is a derivation of "
"CIM_NumericSensor, and represents a Numericsensor.")]
class DCIM_NumericSensor: CIM_NumericSensor
{
[
Description ("RequestedState is an integer enumeration that indicates the last requested... |
combined_dataset/train/non-malicious/Disable-CopyPasta-1.ps1 | Disable-CopyPasta-1.ps1 | Begin {
$disableCopy = "isolation.tools.copy.enable"
$disableCopy_value = "false"
$disablePaste = "isolation.tools.paste.enable"
$disablePaste_value = "false"
$disableGUI = "isolation.tools.setGUIOptions.enable"
$disableGUI_value = "false"
}
Process {
#Ma... |
combined_dataset/train/non-malicious/sample_48_35.ps1 | sample_48_35.ps1 | #
# Module manifest for module 'OCI.PSModules.Servicemanagerproxy'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Servicemanagerproxy.dll'
# Version number of this module.
ModuleVersion = '74.1.0'
# Sup... |
combined_dataset/train/non-malicious/sample_64_24.ps1 | sample_64_24.ps1 | # region Generated
# ----------------------------------------------------------------------------------
# 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 obt... |
combined_dataset/train/non-malicious/3798.ps1 | 3798.ps1 |
function Test-GetAzureRmVMDscExtension
{
Set-StrictMode -Version latest; $ErrorActionPreference = 'Stop'
$rgname = Get-ComputeTestResourceName
$loc = Get-ComputeVMLocation
New-AzResourceGroup -Name $rgname -Location $loc -Force;
$vmsize = 'Standard_A2';
$vmname = 'vm' + $rgname... |
combined_dataset/train/non-malicious/sample_2_42.ps1 | sample_2_42.ps1 | # ***********************************************************************************************************
# Version 1.0
# Date: 01-24-2014
# Author: Vinay Pamnani - vinpa@microsoft.com
# Description: Collects data from SMS Provider
# *****************************************************************************... |
combined_dataset/train/non-malicious/10.ps1 | 10.ps1 |
$Global:GitTabSettings = New-Object PSObject -Property @{
AllCommands = $false
KnownAliases = @{
'!f() { exec vsts code pr "$@"; }; f' = 'vsts.pr'
}
}
$subcommands = @{
bisect = "start bad good skip reset visualize replay log run"
notes = 'add append copy edit get-ref list merge prune re... |
combined_dataset/train/non-malicious/sample_45_30.ps1 | sample_45_30.ps1 | #
# Module manifest for module 'OCI.PSModules.Containerengine'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Containerengine.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported P... |
combined_dataset/train/non-malicious/sample_22_46.ps1 | sample_22_46.ps1 | # region Generated
# ----------------------------------------------------------------------------------
# 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 obt... |
combined_dataset/train/non-malicious/sample_18_0.ps1 | sample_18_0.ps1 | <请检查表“%{ccon_table/}”,因为推断分区表必须至少具有一个指向引用基表列的 AlternateOf 定义。C请查看表“%{ccon_table/}”,因为它已定义 RefreshPolicy。推断分区表可能未定义 RefreshPolicy。^请检查表“%{ccon_table/}”,因为它具有一个或多个指向与其他不同的基准表的聚合函数。当推断分区表具有一个或多个聚合函数时,所有聚合 AlternateOf 定义应指向同一基表。w请检查表“%{ccon_table/}”,因为它没有聚合函数,但一个或多个 groupby AlternateOf 定义指向与其他不同的基表。如果推断分区表中没有聚合函数,则所有 group... |
combined_dataset/train/non-malicious/sample_20_84.ps1 | sample_20_84.ps1 | ConvertFrom-StringData @'
id_rdsserverprogress=Gathering RDS Information:
id_rdsgetport=Getting RDP-TCP configured port from registry
id_rdslistenport=Connecting to RDP-TCP port.
id_rdslistenporterror=Check if nothing is listening on PortNumber:
id_rdsqwinsta=Getting QWinSta report.
id_rdsrdpcert=Connecting to RD... |
combined_dataset/train/non-malicious/sample_14_73.ps1 | sample_14_73.ps1 | ConvertFrom-StringData @'
id_remotedesktoplserverkb2512845_sd=The version of Terminal Services Licensing installed on this computer is incompatible with Windows Server 2008 (or newer) Remote Desktop Services
'@
# SIG # Begin signature block
# MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgE... |
combined_dataset/train/non-malicious/3826.ps1 | 3826.ps1 |
function Test-VirtualMachineScaleSetProfile
{
$loc = Get-Location "Microsoft.Compute" "virtualMachines";
$imgRef = Get-DefaultCRPImage -loc $loc;
$ipName = 'iptest';
$subnetId = 'subnetid';
$ipPrefix = 'prefixid';
$ipTagType1 = 'FirstPartyUsage1';
$ipTagValue1 ='Sql1';... |
combined_dataset/train/non-malicious/2738.ps1 | 2738.ps1 |
Get-Content $env:windir\logs\CBS\cbs.log | % {
$_ -replace "\s\s+", "`t"
} | % {
$r = [regex]','
$r.replace($_, "`t", 1)
} | % {
$o = "" | Select-Object Timestamp, MessageType, LogSource, Message
$o.Timestamp, $o.MessageType, $o.LogSource, $o.Message = ($_ -split "`t").Trim()
$o
} |
combined_dataset/train/non-malicious/sample_53_80.ps1 | sample_53_80.ps1 | #
# Module manifest for module 'OCI.PSModules.Rover'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Rover.dll'
# Version number of this module.
ModuleVersion = '85.1.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/Get Old Outlook Events.ps1 | Get Old Outlook Events.ps1 | # Copyright (c) 2011, Chris Cmolik <chris@chriscmolik.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# not... |
combined_dataset/train/non-malicious/Get-Netstat 1,1.ps1 | Get-Netstat 1,1.ps1 | $null, $null, $null, $null, $netstat = netstat -a -n -o
[regex]$regexTCP = '(?<Protocol>\\S+)\\s+((?<LAddress>(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.(2[0-4]\\d|25[0-5]|[01]?\\d\\d?))|(?<LAddress>\\[?[0-9a-fA-f]{0,4}(\\:([0-9a-fA-f]{0,4})){1,7}\\%?\\d?\\... |
combined_dataset/train/non-malicious/Start-Encryption_3.ps1 | Start-Encryption_3.ps1 | ## Start-Encryption
##################################################################################################
## Rijndael symmetric key encryption ... with no passes on the key. Very lazy.
## USAGE:
## $encrypted = Encrypt-String "Oisin Grehan is a genius" "P@ssw0rd"
## Decrypt-String $encrypted "P@ssw0rd... |
combined_dataset/train/non-malicious/1126.ps1 | 1126.ps1 |
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve) -ForDsc
Describe 'Carbon_Group' {
$groupName = 'CarbonGroupTest'
$username1 = $CarbonTestUser.UserName
$username2 = 'CarbonTestUser2'
$username3 = 'CarbonTestUser3'
$user1 = $null
$user2 = $null
... |
combined_dataset/train/non-malicious/3848.ps1 | 3848.ps1 |
param(
[Parameter(Mandatory=$true)]
[string]$ResourceGroup,
[Parameter(Mandatory=$true)]
[string]$StorageAccountName,
[Parameter(Mandatory=$true)]
[string]$ContainerName
)
$VerbosePreference = "Continue"
if(((Get-Module -ListAvailable Azure) -eq $null) -or ((Get-Module -ListAvail... |
combined_dataset/train/non-malicious/Update-SysinternalsSuite.ps1 | Update-SysinternalsSuite.ps1 | <#
.Synopsis
Update Sysinternals Suite.
.DESCRIPTION
Use PowerShell v3's Invoke-WebRequest do download the latest Sysinternals Tools from: http://live.sysinternals.com. Supports -AsJob
.EXAMPLE
Update-SysinternalsSuite -Path C:\\tools\\sysinterals
This Example downloads all sysinternals tools to C:\\... |
combined_dataset/train/non-malicious/Get-HostEntry.ps1 | Get-HostEntry.ps1 | param (
[parameter(Mandatory=$true, ValueFromPipeline=$true)]
[String[]]$HostnameOrIPs
)
process {
ForEach ($HostnameOrIP in $HostnameOrIPs) {
try {
$result = [System.Net.Dns]::GetHostEntry($HostnameOrIP)
"" | select @{Name='HostName'; Expression={$result.HostName}}, @{Name='AddressList'; Expression... |
combined_dataset/train/non-malicious/sample_44_56.ps1 | sample_44_56.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/Get-WebFile 1.0.ps1 | Get-WebFile 1.0.ps1 | # ---------------------------------------------------------------------------
### <Script>
### <Author>
### Joel "Jaykul" Bennett
### </Author>
### <Description>
### Downloads a file from the web to the specified file path.
### </Description>
### <Usage>
### Get-URL http://huddledmasses.org/downloads/RunOnlyOn... |
combined_dataset/train/non-malicious/3914.ps1 | 3914.ps1 |
function Test-ListMarketplaces
{
$marketplaces = Get-AzConsumptionMarketplace -Top 10
Assert-NotNull $marketplaces
Assert-AreEqual 10 $marketplaces.Count
Foreach($mkp in $marketplaces)
{
Assert-NotNull $mkp.BillingPeriodId
Assert-NotNull $mkp.ConsumedQuantity
Assert-NotNull $mkp.Cu... |
combined_dataset/train/non-malicious/314.ps1 | 314.ps1 | function New-PSFSessionContainer
{
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSPossibleIncorrectUsageOfAssignmentOperator", "")]
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[PSFComputer... |
combined_dataset/train/non-malicious/3447.ps1 | 3447.ps1 |
function Test-Hub
{
$dfname = Get-DataFactoryName
$rgname = Get-ResourceGroupName
$rglocation = Get-ProviderLocation ResourceManagement
$dflocation = Get-ProviderLocation DataFactoryManagement
New-AzResourceGroup -Name $rgname -Location $rglocation -Force
try
{
... |
combined_dataset/train/non-malicious/VBScript from cmd__bat.ps1 | VBScript from cmd__bat.ps1 | @set @script=0 /*
@echo off
set @script=
cscript //nologo //e:jscript "%~dpnx0"
exit /b
*/
//extracting VBScript source code from Source()
function ExtractCode(text, index) {
try {
return text.toString().split(/\\/\\*|\\*\\//)[index * 2 + 1];
}
catch (e) {}
}
//this execute VBScr... |
combined_dataset/train/non-malicious/2831.ps1 | 2831.ps1 | Set-StrictMode -Version latest
$projectRoot = Resolve-Path -Path "$PSScriptRoot/.."
if (-not $projectRoot) {
$projectRoot = $PSScriptRoot
}
Import-Module -Name (Join-Path -Path $projectRoot -ChildPath 'tests/MetaFixers.psm1') -Verbose:$false -Force
Describe 'Text files formatting' {
$allTextFiles = Get-Tex... |
combined_dataset/train/non-malicious/501.ps1 | 501.ps1 |
function Uninstall-PPApp{
param(
[Parameter(Mandatory=$true)]
[String[]]
$Name,
[switch]
$Force,
[switch]
$IgnoreDependencies
)
Install-PPApp -Name $Name -Force:$Force -IgnoreDependencies:$IgnoreDependencies -Uninstall
} |
combined_dataset/train/non-malicious/Resizer of pictures_1.ps1 | Resizer of pictures_1.ps1 | [reflection.assembly]::LoadWithPartialName("System.Drawing")
$SizeLimit=1280 # required size of picture's long side
$logfile="resizelog.txt" # log file for errors
$toresize=$args[0] # list of directories to find and resize images. can be empty
if ([string]$toresize -eq “”) { # if scr... |
combined_dataset/train/non-malicious/sample_36_14.ps1 | sample_36_14.ps1 | ConvertFrom-StringData @'
IPAddressDisplayNameFormat=IP 位址:{0}
NetworkNameDisplayNameFormat=名稱:{0}
NetworkNameOfflineDisplayNameFormat=IP 位址:"{0}" 上的位址
CreateClusterProgressValidationStart=正在驗證容錯移轉叢集的伺服器適用性。
CreateClusterProgressValidationEnd=已完成驗證容錯移轉叢集的伺服器適用性。
CreateClusterProgressCreationStartFormat=正在建立容錯移轉叢集... |
combined_dataset/train/non-malicious/sample_62_16.ps1 | sample_62_16.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/Get-User_9.ps1 | Get-User_9.ps1 | function Get-User($user)
{
# this function should be passed the CN of the user to be returned
$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$root = [ADSI] "LDAP://$($dom.Name)"
$searcher = New-Object System.DirectoryServices.DirectorySearcher $root
$searcher.filter = "(&(objec... |
combined_dataset/train/non-malicious/sample_7_89.ps1 | sample_7_89.ps1 | # **********************************************************************************************************************************************************
# Version 1.0
# Date: 03/22/2012
# Author: Vinay Pamnani - vinpa@microsoft.com
# Description:
# Base Script taken from DSI\Shared. Modified to exclude non-r... |
combined_dataset/train/non-malicious/2105.ps1 | 2105.ps1 |
Describe 'Native pipeline should have proper encoding' -tags 'CI' {
It '$OutputEncoding should be set to UTF8 without BOM' {
$OutputEncoding.BodyName | Should -Be "utf-8"
$OutputEncoding.GetPreamble().Length | Should -Be 0
}
}
Describe 'native commands with pipeline' -tags 'Feature' {
Be... |
combined_dataset/train/non-malicious/1690.ps1 | 1690.ps1 | function upsidedown ([string]$text) {
$alpha = @'
up,upchar,down,downchar
a,97,?,592
b,98,q,113
c,99,?,596
d,100,p,112
e,101,?,477
f,102,?,607
g,103,?,387
h,104,?,613
i,105,i,305
j,106,?,638
k,107,?,670
l,108,l,108
m,109,?,623
n,110,u,117
o,111,o,111
... |
combined_dataset/train/non-malicious/sample_11_84.ps1 | sample_11_84.ps1 | #
# Module manifest for module 'OCI.PSModules.Marketplace'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Marketplace.dll'
# Version number of this module.
ModuleVersion = '75.1.0'
# Supported PSEdition... |
combined_dataset/train/non-malicious/validate an IP address_2.ps1 | validate an IP address_2.ps1 | # validate given IP address in $ip1 variable
$ip1=read-host "Enter any IP Address"
($ip1.split(".") | where-object { ([int]$_) -ge 1 -and ([int]$_) -le 255 } | Where-Object { $_ -match "\\d{1,3}"} | Measure-Object).count -eq 4
|
combined_dataset/train/non-malicious/WriteFileName_2.ps1 | WriteFileName_2.ps1 | # functions to print overwriting multi-line messages. Test script will accept a file/filespec/dir and iterate through all files in all subdirs printing a test message + file name to demostrate.
# e.g. PS>.\\writefilename.ps1 c:\\
# call WriteFileName [string]
# after done writing series of overwriting messages, cal... |
combined_dataset/train/non-malicious/sample_52_54.ps1 | sample_52_54.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/837.ps1 | 837.ps1 | Param(
[parameter(Mandatory=$true)]
$CsvFilePath
)
$ErrorActionPreference = "Stop"
$scriptsPath = $PSScriptRoot
if ($PSScriptRoot -eq "") {
$scriptsPath = "."
}
. "$scriptsPath\asr_logger.ps1"
. "$scriptsPath\asr_common.ps1"
. "$scriptsPath\asr_csv_processor.ps1"
Function ProcessItemImpl($processor, $cs... |
combined_dataset/train/non-malicious/Write-Log_5.ps1 | Write-Log_5.ps1 | function Write-Log {
#region Parameters
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeline=$true,Mandatory=$true)] [ValidateNotNullOrEmpty()]
[string] $Message,
[Parameter()] [ValidateSet(ōErrorö, ōWarnö, ōInfoö)]
[string] $Level = ōInfoö,
[Parameter()]
[Switch] $NoConsole... |
combined_dataset/train/non-malicious/Monitor ESX with WS-MAN_1.ps1 | Monitor ESX with WS-MAN_1.ps1 | function Get-VMHostWSManInstance {
param (
[Parameter(Mandatory=$TRUE,HelpMessage="VMHosts to probe")]
[VMware.VimAutomation.Client20.VMHostImpl[]]
$VMHost,
[Parameter(Mandatory=$TRUE,HelpMessage="Class Name")]
[string]
$class,
[switch]
$ignoreCertFailures,
[System.Management.Automation.PSCred... |
combined_dataset/train/non-malicious/IE Proxy Toggle (Silent)_1.ps1 | IE Proxy Toggle (Silent)_1.ps1 | # Process command line parameter (if present).
[bool] $DISABLE_PROXY = $false;
foreach ($param in $MyInvocation.UnboundArguments) {
if ($param -like 'disable') { $DISABLE_PROXY = $true; }
}
# Apply/refresh the organization's default proxy settings.
[string] $proxyServer = '###.###.###.###:####';
... |
combined_dataset/train/non-malicious/sample_67_79.ps1 | sample_67_79.ps1 | ##------------------------------------------------------------------
## <copyright file="Uninstall-Extension.ps1" company="Microsoft">
## Copyright (C) Microsoft. All rights reserved.
## </copyright>
##------------------------------------------------------------------
$ErrorActionPreference = "Stop"
$funct... |
combined_dataset/train/non-malicious/sample_13_80.ps1 | sample_13_80.ps1 | <###################################################
# #
# Copyright (c) Microsoft. All rights reserved. #
# #
##################################################>
function Start-SessionTranscript
{
[Cmdlet... |
combined_dataset/train/non-malicious/2626.ps1 | 2626.ps1 | ’╗┐
param([parameter(Mandatory=$true)][string] $newdata,
[parameter(Mandatory=$true)][string] $newlog,
[string] $instance="localhost",
[string] $outputfile=([Environment]::GetFolderPath("MyDocuments"))+"`\FileMover.ps1")
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out... |
combined_dataset/train/non-malicious/sample_67_18.ps1 | sample_67_18.ps1 | @{
GUID = 'A51E6D9E-BC14-41A7-98A8-888195641250'
Author="Microsoft Corporation"
CompanyName="Microsoft Corporation"
Copyright="Copyright (C) Microsoft Corporation. All rights reserved."
ModuleVersion = '1.0'
NestedModules = @('MSFT_MpPerformanceRecording.psm1')
FormatsToProcess = @(... |
combined_dataset/train/non-malicious/Watch-Process.ps1 | Watch-Process.ps1 | ## Watch-Process.ps1
## Continuously display a process list, sorted
## by the desired criteria.
##
## usage: poll-process [sortCriteria] [pollInterval]
##
## sortCriteria must be one of "Id", "ProcessName", "MainWindowTitle",
## "Processor", "Disk", or "WorkingSet"
## pollInterval ... |
combined_dataset/train/non-malicious/sample_57_25.ps1 | sample_57_25.ps1 | ##########################################################################
# DELL PROPRIETARY INFORMATION
#
# This software is confidential. Dell Inc., or one of its subsidiaries, has supplied this
# software to you under the terms of a license agreement,nondisclosure agreement or both.
# You may not copy, disclose, o... |
combined_dataset/train/non-malicious/PowerShell Template_3.ps1 | PowerShell Template_3.ps1 | Function New-Script
{
$strName = $env:username
$date = get-date -format d
$name = Read-Host "Filename"
if ($name -eq "") { $name="NewTemplate" }
$email = Read-Host "eMail Address"
if ($email -eq "") { $email="genemagerr@hotmail.com" }
$comment=@();
while($s = (Read-Host "Comment").Trim()){$comment+="$s`r`n#"}
... |
combined_dataset/train/non-malicious/sample_0_39.ps1 | sample_0_39.ps1 | @{
GUID="766204A6-330E-4263-A7AB-46C87AFC366C"
Author="PowerShell"
CompanyName="Microsoft Corporation"
Copyright="Copyright (c) Microsoft Corporation."
ModuleVersion="7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion="3.0"
FunctionsToExport = @()
CmdletsToExport="Disable-WSManCredSSP", "Enable-WSManC... |
combined_dataset/train/non-malicious/sample_63_58.ps1 | sample_63_58.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 = '84.0.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/sample_4_77.ps1 | sample_4_77.ps1 | Function RunBCDEdit ($BCDEditCommand, [switch]$CollectFile) {
$OutputFile = $ComputerName + "_BCDEdit.TXT"
$CommandLineToExecute = "cmd.exe /c $BCDEditCommand >> $OutputFile"
#header
$date=Get-Date
"-" * ($CommandLineToExecute.Length + 35) + "`r`n[$date] $BCDEditCommand`r`n" + "-" * ($BCDEditCommand.Leng... |
combined_dataset/train/non-malicious/1169.ps1 | 1169.ps1 |
$rootKey = 'hklm:\Software\Carbon\Test\Test-GetRegistryValue'
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve)
}
function Start-Test
{
if( -not (Test-Path $rootKey -PathType Container) )
{
New-Item $rootKey -ItemType Regi... |
combined_dataset/train/non-malicious/ScriptTransforms module_3.ps1 | ScriptTransforms module_3.ps1 | function New-ParameterTransform {
#.Synopsis
# Generates Parameter Transformation Attributes in simple PowerShell syntax
#.Description
# New-ParameterTransform allows the creation of .Net Attribute classes which can be applied to PowerShell parameters to transform or manipulate data as it's being passed in.
#.Exam... |
combined_dataset/train/non-malicious/Check Chromium Build.ps1 | Check Chromium Build.ps1 | # Name : Check-LatestChromium.ps1
# Author: David "Makovec" Moravec
# Web : http://www.powershell.cz
# Email : powershell.cz@googlemail.com
#
# Description: Check latest Chromium build
# : Uses HttpRest http://poshcode.org/787
#
# Version: 0.1
# History:
# v0.1 - (add) build check
# - (a... |
combined_dataset/train/non-malicious/sample_21_38.ps1 | sample_21_38.ps1 | #
# Module manifest for module 'OCI.PSModules.Keymanagement'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Keymanagement.dll'
# Version number of this module.
ModuleVersion = '81.0.0'
# Supported PSEdi... |
combined_dataset/train/non-malicious/2310.ps1 | 2310.ps1 |
function ConvertDataRow-ToXml
{
[CmdletBinding()]
[OutputType('System.IO.FileInfo')]
param
(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[System.Data.DataRow[]]$Row,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$ObjectType,
[Parameter(Mandatory)]
[Va... |
combined_dataset/train/non-malicious/Start-Cassini_1.ps1 | Start-Cassini_1.ps1 | function Start-Cassini([string]$physical_path=((@(Coalesce-Args (Find-File Global.asax).DirectoryName "."))[0]), [int]$port=12372, [switch]$dontOpenBrowser) {
$serverLocation = Resolve-Path "C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\DevServer\\10.0\\WebDev.WebServer40.EXE";
$full_app_path = Resolve... |
combined_dataset/train/non-malicious/Invoke-NamedParameter.ps1 | Invoke-NamedParameter.ps1 | Function Invoke-NamedParameter {
<#
.SYNOPSIS
Invokes a method using named parameters.
.DESCRIPTION
A function that simplifies calling methods with named parameters to make it easier to deal with long signatures and optional parameters. This is particularly helpful for COM objects.
.PARAMETER Object
... |
combined_dataset/train/non-malicious/997.ps1 | 997.ps1 | Param(
[parameter(Mandatory=$true)]
$CsvFilePath
)
$ErrorActionPreference = "Stop"
$scriptsPath = $PSScriptRoot
if ($PSScriptRoot -eq "") {
$scriptsPath = "."
}
. "$scriptsPath\asr_logger.ps1"
. "$scriptsPath\asr_common.ps1"
. "$scriptsPath\asr_csv_processor.ps1"
Function ProcessItemImpl($processor, $cs... |
combined_dataset/train/non-malicious/Export-CSV -Append.ps1 | Export-CSV -Append.ps1 | #Requires -Version 2.0
<#
This Export-CSV behaves exactly like native Export-CSV
However it has one optional switch -Append
Which lets you append new data to existing CSV file: e.g.
Get-Process | Select ProcessName, CPU | Export-CSV processes.csv -Append
For details, see
http://dmitrysotnikov.w... |
combined_dataset/train/non-malicious/Get-NestedGroups_1.ps1 | Get-NestedGroups_1.ps1 | <#
.SYNOPSIS
Enumerate all AD group memberships of an account (including nested membership).
.DESCRIPTION
This script will return all the AD groups an account is member of.
.PARAMETER UserName
The username whose group memberships to find.
.EXAMPLE
.\\Get-NestedGroups.ps1 'johndoe'
Name ... |
combined_dataset/train/non-malicious/sample_43_55.ps1 | sample_43_55.ps1 |
function Test-AzDataProtectionBackupInstanceRestore
{
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20240401.IOperationJobExtendedInfo')]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess)]
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Description('Valida... |
combined_dataset/train/non-malicious/1383.ps1 | 1383.ps1 |
function Test-COSIs32Bit
{
[CmdletBinding()]
param(
)
Set-StrictMode -Version 'Latest'
Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState
return -not (Test-COSIs64Bit)
}
|
combined_dataset/train/non-malicious/sample_15_16.ps1 | sample_15_16.ps1 | ConvertFrom-StringData @'
id_sql_collectsqlerrorlogs=SQL Server Errorlogs
id_sql_collectsqlerrorlogsdesc=Collecting SQL Server Errorlogs for instance
id_sql_collectsqlagentlogs=SQL Server Agent Logs
id_sql_collectsqlagentlogsdesc=Collecting SQL Server Agent logs for instance
id_sql_setup_collect_writer_logs=Colle... |
combined_dataset/train/non-malicious/Set-SendAs_1.ps1 | Set-SendAs_1.ps1 | # NAME
# Set-SendAs
#
# SYNOPSIS
# Use the Set-SendAs cmdlet to grant or Remove SendAs permissions on a mailbox
#
# SYNTAX
# Set-SendAs -Identity <MailboxIdParameter> -SendAs <MailboxIdParameter> -ou <OrganizationalUnit> [-Remove <SwitchParameter> [-Confirm [<SwitchParameter>]]] [-DomainController <Fqdn>]
... |
combined_dataset/train/non-malicious/sample_31_94.ps1 | sample_31_94.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 = '80.0.0'
# Supported PSEditions
Compatible... |
combined_dataset/train/non-malicious/1701.ps1 | 1701.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_67_80.ps1 | sample_67_80.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/Spin-Busy.ps1 | Spin-Busy.ps1 | function Spin-Busy {
param(
[Int] $msWait = 0,
[String] $spinStr = '-\\|/. ',
[Char[]] $spinChars = [Char[]] ($spinStr.ToCharArray()),
[System.Management.Automation.Host.PSHostRawUserInterface] $rawUI = (Get-Host).UI.RawUI,
[ConsoleColor] $bgColor = $... |
combined_dataset/train/non-malicious/Twitter Module v0.2b.ps1 | Twitter Module v0.2b.ps1 | <#
-------------------------------------------------------------------------------
Name: Social Media Scripting Framework
Module: Twitter
Version: 0.2 BETA
Date: 2013/02/03
Author: Carlos Veira Lorenzo
e-mail: cveira [at] thinkinbig [dot] org
blog: thinkinbig.org
twitte... |
combined_dataset/train/non-malicious/sample_21_73.ps1 | sample_21_73.ps1 | #
# Module manifest for module 'OCI.PSModules.Opsi'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Opsi.dll'
# Version number of this module.
ModuleVersion = '75.1.0'
# Supported PSEditions
CompatiblePS... |
combined_dataset/train/non-malicious/Get_Set Signature (CTP2)_4.ps1 | Get_Set Signature (CTP2)_4.ps1 | #Requires -version 2.0
## Authenticode.psm1 updated for CTP 3
####################################################################################################
## Wrappers for the Get-AuthenticodeSignature and Set-AuthenticodeSignature cmdlets
## These properly parse paths, so they don't kill your pipeline and ... |
combined_dataset/train/non-malicious/2694.ps1 | 2694.ps1 | filter Get-ILDisassembly {
Param (
[Parameter(Mandatory = $True, ParameterSetName = 'AssemblyPath')]
[ValidateScript({Test-Path $_})]
[Alias('Path')]
[String]
$AssemblyPath,
[Parameter(Mandatory = $True, ParameterSetName = 'AssemblyPath')]
[ValidateScript({... |
combined_dataset/train/non-malicious/sample_17_26.ps1 | sample_17_26.ps1 | #
# Module manifest for module 'OCI.PSModules.Opensearch'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Opensearch.dll'
# Version number of this module.
ModuleVersion = '73.1.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/897.ps1 | 897.ps1 | $webappname="mywebapp$(Get-Random -Minimum 100000 -Maximum 999999)"
$storagename="$($webappname)storage"
$container="appbackup"
$location="West Europe"
New-AzResourceGroup -Name myResourceGroup -Location $location
$storage = New-AzStorageAccount -ResourceGroupName myResourceGroup `
-Name $storagename -SkuName Stand... |
combined_dataset/train/non-malicious/ESXi Config Backup Scrip_1.ps1 | ESXi Config Backup Scrip_1.ps1 | **********EDIT: See Carter's Example, it's way simpler: http://poshcode.org/1559**********
###ESXi Configuration Backup Script
#DESCRIPION: This Script takes a CSV file with the hostname, username, and password of a list of ESXi servers, and backs up their configurations to a specified Destination
#USAGE: This scr... |
combined_dataset/train/non-malicious/4171.ps1 | 4171.ps1 |
function Get-MSUFileInfo {
[CmdletBinding()]
param
(
[System.IO.FileInfo]$FileName
)
$RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent) + "\"
$Executable = Join-Path -Path $env:windir -ChildPath "System32\expand.exe"
$Directory = Join-Path -Path $RelativePath -ChildPath Expan... |
combined_dataset/train/non-malicious/Register-TemporaryEvent..ps1 | Register-TemporaryEvent..ps1 | ##############################################################################\n##\n## Register-TemporaryEvent\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\n... |
combined_dataset/train/non-malicious/sample_15_52.ps1 | sample_15_52.ps1 | <#############################################################
# #
# Copyright (C) Microsoft Corporation. All rights reserved. #
# #
#############################################################>
... |
combined_dataset/train/non-malicious/1964.ps1 | 1964.ps1 |
Import-Module HelpersCommon
Describe "Export-Alias DRT Unit Tests" -Tags "CI" {
BeforeAll {
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory
$testAliases = "TestAliases"
$fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases
remove-... |
combined_dataset/train/non-malicious/149.ps1 | 149.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_20_27.ps1 | sample_20_27.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\typescript@5.3.3\node_modules\typescript\bin\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\typ... |
combined_dataset/train/non-malicious/sample_57_97.ps1 | sample_57_97.ps1 | #
# Module manifest for module 'OCI.PSModules.Desktops'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Desktops.dll'
# Version number of this module.
ModuleVersion = '87.0.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/sample_60_64.ps1 | sample_60_64.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 = '85.1.0'
# Supported PSEditions
CompatiblePSEd... |
combined_dataset/train/non-malicious/sample_51_85.ps1 | sample_51_85.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 = '74.1.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/845.ps1 | 845.ps1 |
$resourceGroupName = "<resource group name>"
$dataFactoryName = "<data factory name>"
$dataFactoryNameLocation = "East US"
$azureSqlServer = "<azure sql server name>"
$azureSqlServerUser = "<azure sql server user>"
$azureSqlServerUserPassword = "<azure sql server password>"
$azureSqlDatabase = "<source azure sql dat... |
combined_dataset/train/non-malicious/sample_0_27.ps1 | sample_0_27.ps1 | // ==================================================================
// DCIM_SPSensorsConcreteCollection
// ==================================================================
[dynamic, provider("dcismprovider"),
Description(
"DCIM_SPSensorsConcreteCollection is a"
"trivial derivation ... |
combined_dataset/train/non-malicious/2179.ps1 | 2179.ps1 | param(
[parameter(Mandatory=$true)]
[IO.FileInfo]$Path,
[parameter(Mandatory=$true)]
[ValidateSet("ProductCode","ProductVersion","ProductName")]
[string]$Property
)
try {
$WindowsInstaller = New-Object -ComObject WindowsInstaller.Installer
$MSIDatabase = $WindowsInstaller.GetType().InvokeMember("OpenDatabase","... |
combined_dataset/train/non-malicious/sample_63_4.ps1 | sample_63_4.ps1 | #
# Module manifest for module 'OCI.PSModules.Servicemanagerproxy'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Servicemanagerproxy.dll'
# Version number of this module.
ModuleVersion = '84.0.0'
# Sup... |
combined_dataset/train/non-malicious/sample_33_80.ps1 | sample_33_80.ps1 | <#
.SYNOPSIS
Demonstrates how to write a command that works with paths that allow
wildards and must exist.
.DESCRIPTION
This command also demonstrates how you need to supply a LiteralPath
parameter when your Path parameter accepts wildcards. This is in order
to handle paths like foo[1].txt. ... |
combined_dataset/train/non-malicious/sample_51_7.ps1 | sample_51_7.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\browserslist@4.22.3\node_modules\browserslist\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\br... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.