full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/PWD Expiration Email_1.ps1
PWD Expiration Email_1.ps1
#Active Directory Group Name To Be Edited #Load Active Directory Module if(@(get-module | where-object {$_.Name -eq "ActiveDirectory"} ).count -eq 0) {import-module ActiveDirectory} # get domain maximumPasswordAge value $MaxPassAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge.days if($MaxPassAge -le ...
combined_dataset/train/non-malicious/Bootstrap psake w_ PsGet_1.ps1
Bootstrap psake w_ PsGet_1.ps1
# Get-MyModule adapted from http://blogs.technet.com/b/heyscriptingguy/archive/2010/07/11/hey-scripting-guy-weekend-scripter-checking-for-module-dependencies-in-windows-powershell.aspx function Get-MyModule { param ([string] $name) write-host "Is '$name' already imported? " -NoNewline -ForegroundColor Cyan ...
combined_dataset/train/non-malicious/693.ps1
693.ps1
function New-RsWebServiceProxyHelper { [CmdletBinding()] Param ( [AllowNull()] [object] $BoundParameters ) if ($BoundParameters["Proxy"]) { return $BoundParameters["Proxy"] } $goodKeys = @("ReportServerUri", "Credential", "ApiVersion", "CustomAu...
combined_dataset/train/non-malicious/sample_34_18.ps1
sample_34_18.ps1
ConvertFrom-StringData @' ###PSLOC MissingRequiredParameter = Parameter '{0}' not found on command line or in configuration file : {1} MalformedRequiredParameter = Parameter '{0}' value '{1}' does not match expected format '{2}' ADOUPathDescription = Organizational Unit (OU) for the HCI deployment must be specified...
combined_dataset/train/non-malicious/sample_67_33.ps1
sample_67_33.ps1
# # Module manifest for module 'PSGet_AzStackHci.EnvironmentChecker' # # Generated by: Microsoft Corporation # # Generated on: 19/01/2022 # @{ # Script module or binary module file associated with this manifest. RootModule = '' # Version number of this module. ModuleVersion = '1.2100.26...
combined_dataset/train/non-malicious/2143.ps1
2143.ps1
Describe 'Line Continuance' -Tags 'CI' { BeforeAll { function ExecuteCommand { param ([string]$command) [powershell]::Create().AddScript($command).Invoke() } $whitespace = "`t `f`v$([char]0x00a0)$([char]0x0085)" } Context 'Lines ending with a backtick tha...
combined_dataset/train/non-malicious/sample_55_33.ps1
sample_55_33.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/sample_37_75.ps1
sample_37_75.ps1
/////////////////////////////////////////////////////////////////////////////// // Helper to set a designer prop /////////////////////////////////////////////////////////////////////////////// function setDesignerProp(tname, ttype, tvalue) { var trait = document.designerProps.getOrCreateTrait(tname, ttype, 0)...
combined_dataset/train/non-malicious/sample_42_80.ps1
sample_42_80.ps1
# # Module manifest for module 'GCArcService' # # Generated by: Microsoft # # Generated on: 08/09/2020 # @{ # Script module or binary module file associated with this manifest. ModuleToProcess = 'GCArcService.psm1' # Version number of this module. ModuleVersion = '1.0' # ID used to uniquely identify...
combined_dataset/train/non-malicious/865.ps1
865.ps1
function New-ClusterWithZeppelin { $ErrorActionPreference = "Stop" $context = Get-AzContext if ($context -eq $null) { Connect-AzAccount } $context $resourceGroupName = Read-Host -Prompt "Enter the resource group name" $location = Read-Host -Promp...
combined_dataset/train/non-malicious/sample_38_72.ps1
sample_38_72.ps1
# # Module manifest for module 'Microsoft.SME.ServerManager' # @{ # Script module or binary module file associated with this manifest. RootModule = 'Microsoft.SME.ServerManager.psm1' # Version number of this module. ModuleVersion = '4.13.0' # Supported PSEditions # CompatiblePSEditions = @() # ID us...
combined_dataset/train/non-malicious/f86998a1-d0da-4204-b566-a9031310d3f9.ps1
f86998a1-d0da-4204-b566-a9031310d3f9.ps1
################################################################################################################ # # NAME # Copy-Data # # SYNOPSIS # Copy Data between Folders including a Progressbar # # SYNTAX # Copy-Data [Source <PathToSource>] [Destination <PathToDestination>] [-Confirm] [-Recu...
combined_dataset/train/non-malicious/sample_39_74.ps1
sample_39_74.ps1
@{ GUID = 'C46BE3DC-30A9-452F-A5FD-4BF9CA87A854' Author="Microsoft Corporation" CompanyName="Microsoft Corporation" Copyright="Copyright (C) Microsoft Corporation. All rights reserved." ModuleVersion = '1.0' NestedModules = @( 'MSFT_MpComputerStatus.cdxml', 'MSFT_Mp...
combined_dataset/train/non-malicious/2545.ps1
2545.ps1
function Test-PsRemoting { param( [Parameter(Mandatory = $true)] $computername ) try { $errorActionPreference = "Stop" $result = Invoke-Command -ComputerName $computername { 1 } } catch { Write-Host $computername $false return $false } ...
combined_dataset/train/non-malicious/sample_67_73.ps1
sample_67_73.ps1
@{ GUID="EEFCB906-B326-4E99-9F54-8B4BB6EF3C6D" Author="PowerShell" CompanyName="Microsoft Corporation" Copyright="Copyright (c) Microsoft Corporation." ModuleVersion="7.0.0.0" CompatiblePSEditions = @("Core") PowerShellVersion="3.0" NestedModules="Microsoft.PowerShell.Commands.Management.dll" HelpInfoURI = 'ht...
combined_dataset/train/non-malicious/1358.ps1
1358.ps1
function Get-CScheduledTask { [CmdletBinding()] [OutputType([Carbon.TaskScheduler.TaskInfo])] param( [Parameter()] [Alias('TaskName')] [string] $Name, [Switch] $AsComObject ) Set-StrictMode -Version 'Latest' ...
combined_dataset/train/non-malicious/d31912bc-a156-4199-bcff-5b779e89a274.ps1
d31912bc-a156-4199-bcff-5b779e89a274.ps1
[void][system.reflection.Assembly]::LoadWithPartialName("MySql.Data") # Open Connection $connStr = "server=127.0.0.1;port=3306;uid=root;pwd=perilous;database=test;Pooling=False" $conn = New-Object MySql.Data.MySqlClient.MySqlConnection($connStr) $conn.Open() # write the info $sql = "INSERT INTO table1 (n...
combined_dataset/train/non-malicious/1954.ps1
1954.ps1
Describe "Write-Output DRT Unit Tests" -Tags "CI" { It "Simple Write Object Test" { $objectWritten = 1, 2.2, @("John", "Smith", 10), "abc" $results = Write-Output $objectWritten $results.Length | Should -Be $objectWritten.Length $results[0] | Should -Be $objectWritten[0] $...
combined_dataset/train/non-malicious/sample_62_25.ps1
sample_62_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/sample_40_40.ps1
sample_40_40.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 = '79.0.0' # Supported PSEdi...
combined_dataset/train/non-malicious/1661.ps1
1661.ps1
$filedate = get-date $computer = gc env:computername $metricsData = get-vm | measure-vm $tableColor = "WhiteSmoke" $errorColor = "Red" $warningColor = "Yellow" $FromEmail = "email@email.org" $ToEmail = "email@email.org" $smtpServer = "smtp.yourISP.com" $smtpCreds = new-object Net.NetworkCredential("yourUsername", "Y...
combined_dataset/train/non-malicious/3406.ps1
3406.ps1
function Test-VirtualMachineProfile { $vmsize = 'Standard_A2'; $vmname = 'pstestvm' + ((Get-Random) % 10000); $p = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize; Assert-AreEqual $p.HardwareProfile.VmSize $vmsize; $ipname = 'hpfip' + ((Get-Random) % 10000); $ipRefU...
combined_dataset/train/non-malicious/1929.ps1
1929.ps1
Import-Module HelpersCommon Describe "Set-Date for admin" -Tag @('CI', 'RequireAdminOnWindows', 'RequireSudoOnUnix') { It "Set-Date should be able to set the date in an elevated context" -Skip:(Test-IsVstsLinux) { { Get-Date | Set-Date } | Should -Not -Throw } It "Set-Date should be a...
combined_dataset/train/non-malicious/sample_6_65.ps1
sample_6_65.ps1
PARAM ($WorkingPath = $PWD.Path, $SchemaXMLPath = 'ConfigXPLSchema.xml') ## Initializing Variables $ComputerName = $Env:COMPUTERNAME [xml] $SchemaXML = $null $DiscoveryReportXMLPath = Join-Path $WorkingPath ($ComputerName + '_DiscoveryReport.xml') $StatusXMLPath = Join-Path $WorkingPath ($ComputerName + '...
combined_dataset/train/non-malicious/Monitor-FileSize_2.ps1
Monitor-FileSize_2.ps1
function Monitor-FileSize { <# .Synopsis Checks the file size of a given file until it reaches the specified size .Description Checks the file size of a given file until it reaches the specified size. AT that point, it alerts the user as to what the original file-size-boundry was and what it currentl...
combined_dataset/train/non-malicious/HuddledTricks_2.ps1
HuddledTricks_2.ps1
#Requires -version 2.0 ## Stupid PowerShell Tricks ################################################################################################### add-type @" using System; using System.Runtime.InteropServices; public class Tricks { [DllImport("user32.dll")] private static extern bool ShowWindowAsync(...
combined_dataset/train/non-malicious/sample_63_80.ps1
sample_63_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/Set-PrimaryDnsSuffix.ps1
Set-PrimaryDnsSuffix.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 renamefull { ...
combined_dataset/train/non-malicious/sample_25_76.ps1
sample_25_76.ps1
# # Module manifest for module 'Az.ConfidentialLedger' # # Generated by: Microsoft Corporation # # Generated on: 23/04/2024 # @{ # Script module or binary module file associated with this manifest. RootModule = 'Az.ConfidentialLedger.psm1' # Version number of this module. ModuleVersion = '1.0.1' # S...
combined_dataset/train/non-malicious/sample_46_82.ps1
sample_46_82.ps1
@{ GUID = "A94C8C7E-9810-47C0-B8AF-65089C13A35A" Author = "PowerShell" CompanyName = "Microsoft Corporation" Copyright = "Copyright (c) Microsoft Corporation." ModuleVersion = "7.0.0.0" CompatiblePSEditions = @("Core") PowerShellVersion = "3.0" FunctionsToExport = @() CmdletsToExport = "Get-Credential", "Get-ExecutionP...
combined_dataset/train/non-malicious/Get-SQLFileSize.ps1
Get-SQLFileSize.ps1
Function Get-SQLFileSize { <# .SYNOPSIS Retrieves the file size of a MDF or LDF file for a SQL Server .DESCRIPTION Retrieves the file size of a MDF or LDF file for a SQL Server .PARAMETER Computer Computer hosting a SQL Server .NOTES Name: Get-SQLFileSize Author: Boe Prox ...
combined_dataset/train/non-malicious/sample_44_20.ps1
sample_44_20.ps1
# # Module manifest for module 'OCI.PSModules.Vbsinst' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Vbsinst.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEditions Compat...
combined_dataset/train/non-malicious/1122.ps1
1122.ps1
$originalText = $null $protectedText = $null $secret = [Guid]::NewGuid().ToString() $rsaCipherText = $null $publicKeyPath = Join-Path -Path $PSScriptRoot -ChildPath 'CarbonTestPublicKey.cer' -Resolve $privateKeyPath = Join-Path -Path $PSScriptRoot -ChildPath 'CarbonTestPrivateKey.pfx' -Resolve $dsaKeyPath =...
combined_dataset/train/non-malicious/Convert-BounceToX_12.ps1
Convert-BounceToX_12.ps1
# $Id: Convert-BounceToX500.ps1 610 2010-11-16 00:39:19Z jon $ # $Revision: 610 $ #.Synopsis # Convert Bounce to X500 #.Description # Convert URL Encoded address in a Bounce message to an X500 address # that can be added as an alias to the mail-enabled object #.Parameter bounceAddress # URL Encoded bounce...
combined_dataset/train/non-malicious/2934.ps1
2934.ps1
Framework '4.6.1' task default -depends MsBuild task MsBuild { if ( $IsMacOS -OR $IsLinux ) {} else { $output = &msbuild /version /nologo 2>&1 Assert ($output -NotLike '14.0') '$output should contain 14.0' } }
combined_dataset/train/non-malicious/sudo.ps1
sudo.ps1
[CmdletBinding()] Param( [Parameter(ValueFromRemainingArguments=$true)] $command=$(Read-Host "You must specify a command") ) #requires -version 2.0 function global:Sudo { ## In order to use this, you have to ## Create a "Scheduled Task" named "Elevated powershell.exe" to run ## PowerShell -Command ...
combined_dataset/train/non-malicious/Brushes_1.ps1
Brushes_1.ps1
$frmMain_OnLoad= { $m_BrushSize = New-Object Drawing.Rectangle(0, 0, $picDemo.Width, $picDemo.Height) $wm = [Drawing.Drawing2D.WrapMode] $cboWraM.Items.AddRange(@($wm::Clamp, $wm::Tile, $wm::TileFlipX, $wm::TileFlipY, $wm::TileFlipXY)) $cboWraM.SelectedIndex = 0 [int]$maxHatchStyle = 53 for ($i ...
combined_dataset/train/non-malicious/4458.ps1
4458.ps1
function Register-PSResourceRepository { [OutputType([void])] [Cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = 'NameParameterSet')] Param ( [Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'NameParameterSet')] [Validat...
combined_dataset/train/non-malicious/sample_33_23.ps1
sample_33_23.ps1
ConvertFrom-StringData @' ###PSLOC ElevationModeInfo = Powershell running as Administrator. Continuing........ ElevationModeMsg = Running as administrator is required for this operation.Please restart PowerShell as Administrator and retry. ElevationModeErrMsg = This operation requires elevation. PsSessionFail = Un...
combined_dataset/train/non-malicious/sample_13_79.ps1
sample_13_79.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/Copy files .ps1
Copy files .ps1
cls <# Writer: Ritesh P. #> # Core Declaration $date = ((get-date).toString('MM-dd-yyyy')) $time = ((Get-Date).toString('HH-mm-ss')) #$what = "/COPYALL /S /B" #$options = "/R:0 /W:0 /FP" $NewDestinationPath = '\\\\'+'infra'+'\\c$\\data1\\'+$date+'-'+$time # When I add $time to create Destination f...
combined_dataset/train/non-malicious/323.ps1
323.ps1
function Get-PSFMessageLevelModifier { [CmdletBinding(HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Get-PSFMessageLevelModifier')] Param ( [string] $Name = "*" ) ([PSFramework.Message.MessageHost]::MessageLevelModifiers.Values) | Where-Object Name -Like $Name }
combined_dataset/train/non-malicious/sample_45_41.ps1
sample_45_41.ps1
# Download new TLS certs from Windows Update Write-Host "Updating TLS certificate store at:" Get-Date Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "_tlscerts" | Out-Null $certdir = (New-Item -ItemType Directory -Name "_tlscerts") certutil -syncwithWU "$certdir" Foreach ($file in (Get-ChildItem -Path "$cert...
combined_dataset/train/non-malicious/306.ps1
306.ps1
function Register-PSFRunspace { [CmdletBinding(PositionalBinding = $false, HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Register-PSFRunspace')] param ( [Parameter(Mandatory = $true)] [Scriptblock] $ScriptBlock, [Parameter(Mandatory = $true)] [String] $Name, [switch] $N...
combined_dataset/train/non-malicious/sample_56_22.ps1
sample_56_22.ps1
# # Module manifest for module 'OCI.PSModules.Accessgovernancecp' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Accessgovernancecp.dll' # Version number of this module. ModuleVersion = '85.1.0' # Suppo...
combined_dataset/train/non-malicious/3182.ps1
3182.ps1
Properties { $ProjectRoot = $ENV:BHProjectPath if(-not $ProjectRoot) { $ProjectRoot = Split-Path $PSScriptRoot -Parent } $Timestamp = Get-date -uformat "%Y%m%d-%H%M%S" $PSVersion = $PSVersionTable.PSVersion.Major $TestFile = "TestResults_PS$PSVersion`_$Tim...
combined_dataset/train/non-malicious/BridgeBot 1.1.ps1
BridgeBot 1.1.ps1
## Depends on the PoshXmpp.dll from http://CodePlex.com/PowerXmpp #requires -pssnapin PoshXmpp ## Requires System.Web for the RSS-feed option [Reflection.Assembly]::LoadWithPartialName("System.Web") | Out-Null ########################################################################################## # @Author: Joe...
combined_dataset/train/non-malicious/CD.psm1.ps1
CD.psm1.ps1
PARAM ( $MaxEntryCount = 50) <# Author: Bartek Bielawski (@bielawb on Twitter) Adds cd- functionality known in bash, an probably some other shells. Version: 0.1 Any comments/ feedback welcome, ping me on twitter on via e-mail (bartb at aster dot pl) #> <# We have to modify prompt funct...
combined_dataset/train/non-malicious/2913.ps1
2913.ps1
Framework '4.6' task default -depends MsBuild task MsBuild { if ( $IsMacOS -OR $IsLinux ) {} else { $output = &msbuild /version /nologo 2>&1 Assert ($output -NotLike '14.0') '$output should contain 14.0' } }
combined_dataset/train/non-malicious/Generate-Acronyms.ps1
Generate-Acronyms.ps1
param([String] $phrase) $words = $phrase.Split() $MaxLettersPerWord = 3 $output = @('') $maxSize = [System.Math]::Pow($MaxLettersPerWord, $words.Count) 1..$words.Count | % { $word, $words = $words $output | % { $oldWord = $_ 1..$MaxLettersPerWord | % { $output += $oldWord + $word.SubString(...
combined_dataset/train/non-malicious/2293.ps1
2293.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true, HelpMessage="Specify the internal FQDN of the Primary ADFS server that will be used as context for configuration.")] [ValidateNotNullOrEmpty()] [ValidateScript({Test-Connection -ComputerName $_ -Count 1 -Quiet})] [string]$C...
combined_dataset/train/non-malicious/sudo for Powershell_1.ps1
sudo for Powershell_1.ps1
# sudo.ps1 # # Authors: pezhore, mrigns, This guy: http://tsukasa.jidder.de/blog/2008/03/15/scripting-sudo-with-powershell # Other powershell peoples. # # Sources: # http://tsukasa.jidder.de/blog/2008/03/15/scripting-sudo-with-powershell # http://www.ainotenshi.org/%E2%80%98sudo%E2%80%99-for...
combined_dataset/train/non-malicious/sample_23_65.ps1
sample_23_65.ps1
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. #------------------------------------------------------------------------- Function CheckConfigureAccountPermissionsPrerequisites { # Check if all the features installed by ...
combined_dataset/train/non-malicious/1400.ps1
1400.ps1
function Use-CallerPreference { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] $Cmdlet, [Parameter(Mandatory = $true)] [Management.Automation.SessionState] $SessionState ) Set-StrictMode -Ve...
combined_dataset/train/non-malicious/HttpRest 1.1.0.ps1
HttpRest 1.1.0.ps1
#requires -version 2.0 ## HttpRest module #################################################################################################### ## Initial stages of changing HttpRest into a v2-only module ## Based on the REST api from MindTouch's Dream SDK ## ## INSTALL: ## You need mindtouch.dream.dll (mindtouch...
combined_dataset/train/non-malicious/sample_38_20.ps1
sample_38_20.ps1
# # Module manifest for module 'Az.Automanage' # # Generated by: Microsoft Corporation # # Generated on: 23/04/2024 # @{ # Script module or binary module file associated with this manifest. RootModule = 'Az.Automanage.psm1' # Version number of this module. ModuleVersion = '1.0.1' # Supported PSEditi...
combined_dataset/train/non-malicious/330.ps1
330.ps1
function Resolve-PSFPath { [CmdletBinding(HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Resolve-PSFPath')] param ( [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] [string[]] $Path, [string] $Provider, [switch] $SingleItem, [switch] $NewChild ...
combined_dataset/train/non-malicious/Google Chromium Download.ps1
Google Chromium Download.ps1
<# .Synopsis Download Google Chromium if there is a later build. .Description Download Google Chromium if there is a later build. #> Set-StrictMode -Version Latest Import-Module bitstransfer # comment out when not debugging $VerbosePreference = "Continue" #$VerbosePreferenc...
combined_dataset/train/non-malicious/Findup_29.ps1
Findup_29.ps1
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Security.Cryptography; using System.Runtime.InteropServices; using Microsoft.Win32; using System.IO; using System.Text.RegularExpressions; namespace Findup { public class FileLengthComparer : I...
combined_dataset/train/non-malicious/1302.ps1
1302.ps1
function Test-CPrivilege { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string] $Identity, [Parameter(Mandatory=$true)] [string] $Privilege ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet...
combined_dataset/train/non-malicious/956.ps1
956.ps1
$uniqueId=$(-join ((97..122) + (48..57) | Get-Random -Count 15 | % {[char]$_})) $apiVersion = "2015-04-08" $location = "West US 2" $resourceGroupName = "myResourceGroup" $accountName = "mycosmosaccount-$uniqueId" $resourceType = "Microsoft.DocumentDb/databaseAccounts" $locations = @( @{ "locationName"="West U...
combined_dataset/train/non-malicious/1927.ps1
1927.ps1
Describe "Get-Variable DRT Unit Tests" -Tags "CI" { It "Get-Variable of not existing variable Name should throw ItemNotFoundException"{ { Get-Variable -ErrorAction Stop -Name nonexistingVariableName } | Should -Throw -ErrorId "VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand" } It "Get-Vari...
combined_dataset/train/non-malicious/2897.ps1
2897.ps1
properties { $container = @{} $container.foo = "foo" $container.bar = $null $foo = 1 $bar = 1 } task default -depends TestInit task TestInit { Assert ($container.foo -eq "foo") "$container.foo should be foo" Assert ($container.bar -eq "bar") "$container.bar should be bar" Assert ($contain...
combined_dataset/train/non-malicious/sample_3_4.ps1
sample_3_4.ps1
// Copyright (c) 2016 Dell Inc. or its subsidiaries. All Rights Reserved. // ================================================================== // DCIM_IPMICLPAccountManagementCapabilities // ================================================================== [ dynamic, provider("dcismprovider"), Descrip...
combined_dataset/train/non-malicious/866.ps1
866.ps1
function New-Cluster { $ErrorActionPreference = "Stop" $context = Get-AzContext if ($context -eq $null) { Connect-AzAccount } $context $resourceGroupName = Read-Host -Prompt "Enter the resource group name" $location = Read-Host -Prompt "Enter the...
combined_dataset/train/non-malicious/sample_6_30.ps1
sample_6_30.ps1
# # Module manifest for module 'OCI.PSModules.Osmanagementhub' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Osmanagementhub.dll' # Version number of this module. ModuleVersion = '92.1.0' # Supported P...
combined_dataset/train/non-malicious/sample_13_68.ps1
sample_13_68.ps1
function Convert-AclLogs { <# .SYNOPSIS Converts ACL Logs for the specified time duration at the specific path to Azure Network Watcher Format .DESCRIPTION Converts ACL Logs for the specified time duration at the specific path to Azure Network Watcher Format .ROLE Readers #> param( [Parameter(Ma...
combined_dataset/train/non-malicious/sample_37_48.ps1
sample_37_48.ps1
# # Module manifest for module 'OCI.PSModules.Dts' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Dts.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/sample_7_73.ps1
sample_7_73.ps1
ConvertFrom-StringData @' id_kb2475761title=Checking Event Logs id_kb2475761description=Checking event logs for known issues. '@ # SIG # Begin signature block # MIIoUgYJKoZIhvcNAQcCoIIoQzCCKD8CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIB...
combined_dataset/train/non-malicious/sample_49_16.ps1
sample_49_16.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/sample_7_23.ps1
sample_7_23.ps1
# # Module manifest for module 'OCI.PSModules.Dataflow' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Dataflow.dll' # Version number of this module. ModuleVersion = '92.1.0' # Supported PSEditions Comp...
combined_dataset/train/non-malicious/sample_15_13.ps1
sample_15_13.ps1
ConvertFrom-StringData @' id_b2693877_sophos_befltchecktitle=Checking for Ultimaco Safeware disk encryption id_b2693877_sophos_befltcheckdesc=Checking for Ultimaco Safeware disk encryption version 5.6 id_b2693877_sophos_befltchecksd=Ultimaco Safeware (Sophos) disk encryption version 5.6 is known to cause corruption ...
combined_dataset/train/non-malicious/sample_21_74.ps1
sample_21_74.ps1
{{ $integrations := (index . "integrations") }} {{ $scratch := newScratch }} {{ range $name, $integration := $integrations }} {{ $scratch.Set "tutorials" 0 }} {{ if isset $integration "tutorials" }} {{ $hosts := slice }} {{ range $elem := index $integration "tutorials" }} {{ $url := urls.Parse $elem ...
combined_dataset/train/non-malicious/finddupe_17.ps1
finddupe_17.ps1
# new version has more error handling, "-delete" and "-noprompt" options. function Get-MD5([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]')) { $stream = $null; $cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider]; $hashAlgorithm = new-object $cryp...
combined_dataset/train/non-malicious/sample_39_13.ps1
sample_39_13.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/2922.ps1
2922.ps1
task default -depends 'TaskAFromModuleA' task 'TaskAFromModuleA' -FromModule TaskModuleA -minimumVersion 0.1.0 -maximumVersion 0.1.0 task 'TaskAFromModuleB' -Frommodule TaskModuleB -minimumVersion 0.2.0 -lessThanVersion 0.3.0 task 'TaskbFromModuleA' -FromModule TaskModuleA -maximumVersion 0.1.0 task 'TaskbFromModul...
combined_dataset/train/non-malicious/sample_41_70.ps1
sample_41_70.ps1
<############################################################## # # # Copyright (C) Microsoft Corporation. All rights reserved. # # # ##############################################################>...
combined_dataset/train/non-malicious/sample_64_8.ps1
sample_64_8.ps1
function CheckResourceGraphModuleDependency { [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()] param() process { $module = Get-Module -ListAvailable | Where-Object { $_.Name -eq "Az.ResourceGraph" } if ($null -eq $module) { $message = "Az.ResourceGraph...
combined_dataset/train/non-malicious/sample_65_52.ps1
sample_65_52.ps1
# # Copyright 2018-2024 HP Development Company, L.P. # All Rights Reserved. # # NOTICE: All information contained herein is, and remains the property of HP Inc. # # The intellectual and technical concepts contained herein are proprietary to HP Inc # and may be covered by U.S. and Foreign Patents, patents in p...
combined_dataset/train/non-malicious/sample_45_83.ps1
sample_45_83.ps1
# # Module manifest for module 'OCI.PSModules.Artifacts' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Artifacts.dll' # Version number of this module. ModuleVersion = '73.1.0' # Supported PSEditions Co...
combined_dataset/train/non-malicious/sample_21_28.ps1
sample_21_28.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_50_92.ps1
sample_50_92.ps1
# # Module manifest for module 'OCI.PSModules.Workrequests' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Workrequests.dll' # Version number of this module. ModuleVersion = '73.1.0' # Supported PSEditi...
combined_dataset/train/non-malicious/1592.ps1
1592.ps1
function Get-Header { param ( [string]$path, [int]$bits = 4 ) $path = Resolve-FullPath $path try { $HeaderAsHexString = New-Object System.Text.StringBuilder [Byte[]](Get-Content -Path $path -TotalCount $bits -Encoding Byte -ea Stop) | % { if...
combined_dataset/train/non-malicious/Get-LeaderBoard_2.ps1
Get-LeaderBoard_2.ps1
<# .SYNOPSIS Pulls down the leaderboards for the 2011 Scripting Games .DESCRIPTION Quick and dirty script to pull down the leaderboards for the 2011 scripting games. Can choose either beginner or advanced via a command line switch. To see the output in a table, you must pipe to "format-table -autosi...
combined_dataset/train/non-malicious/Backup-EventLogs_1.ps1
Backup-EventLogs_1.ps1
Function Backup-EventLogs { <# .SYNOPSIS Backup Eventlogs from remote computer .DESCRIPTION This function backs up all logs on a Windows computer that have events written in them. This log is stored as a .csv file in the current directory, where the filenam...
combined_dataset/train/non-malicious/Reflection Module _1.1.ps1
Reflection Module _1.1.ps1
#requires -version 2.0 # ALSO REQUIRES Autoload for some functionality (Latest version: http://poshcode.org/3173) # You should create a Reflection.psd1 with the contents: # @{ ModuleToProcess="Reflection.psm1"; RequiredModules = @("Autoload"); GUID="64b5f609-970f-4e65-b02f-93ccf3e60cbb"; ModuleVersion="4.5.0.0" ...
combined_dataset/train/non-malicious/Test-UserCredential_3.ps1
Test-UserCredential_3.ps1
function Test-UserCredential { [CmdletBinding(DefaultParameterSetName = "set1")] [OutputType("set1", [System.Boolean])] [OutputType("PSCredential", [System.Boolean])] param( [Parameter(Mandatory=$true, ParameterSetName="set1", position=0)] [ValidateNotNullOrEmpty()] [String] $Username, [Parameter...
combined_dataset/train/non-malicious/Test-Port.ps1
Test-Port.ps1
Param([string]$srv,$port=135,$timeout=3000,[switch]$verbose) # Test-Port.ps1 # Does a TCP connection on specified port (135 by default) $ErrorActionPreference = "SilentlyContinue" # Create TCP Client $tcpclient = new-Object system.Net.Sockets.TcpClient # Tell TCP Client to connect to machine on Port ...
combined_dataset/train/non-malicious/1084.ps1
1084.ps1
Set-StrictMode -Version 'Latest' Describe 'Bin Directory' { foreach( $clr in @( 'coreclr', 'fullclr' ) ) { $allowedAssemblies = &{ 'Carbon.dll' 'Carbon.Iis.dll' 'Carbon.Xdt.dll' if( $clr -eq 'coreclr' ) { 'Microsoft.Web.Admini...
combined_dataset/train/non-malicious/Get-Credential++_1.ps1
Get-Credential++_1.ps1
## Get-Credential ## An improvement over the default cmdlet which has no options ... ################################################################################################### ## History ## v 2.0 Rewrite for v2 to replace the default Get-Credential ## v 1.2 Refactor ShellIds key out to a variable, and wr...
combined_dataset/train/non-malicious/sample_22_35.ps1
sample_22_35.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 = '75.1.0' # Supported P...
combined_dataset/train/non-malicious/sample_8_92.ps1
sample_8_92.ps1
ConvertFrom-StringData @' id_ctsaddons=Setup App Compat Component id_ctsaddonsdescription=Collects Setup App Compat information. '@ # SIG # Begin signature block # MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIB...
combined_dataset/train/non-malicious/92.ps1
92.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/b87a3777-9def-4855-88ea-f9ae2610a469.ps1
b87a3777-9def-4855-88ea-f9ae2610a469.ps1
#alias,addnewemailaddress import-csv .\\source.csv | foreach { $user = Get-Mailbox $_.alias $user.emailAddresses+= $_.addnewemailaddress $user.primarysmtpaddress = $_.addnewemailaddress Set-Mailbox $user -emailAddresses $user.emailAddresses set-Mailbox $user -PrimarySmtpAddress $user.primarysmtpaddress }
combined_dataset/train/non-malicious/Test-Port_4.ps1
Test-Port_4.ps1
function Test-Port{ <# .SYNOPSIS Tests port on computer. .DESCRIPTION Tests port on computer. .PARAMETER computer Name of server to test the port connection on. .PARAMETER port Port to test .PARAMETER tcp Use tcp port .PARAMETER udp Use udp port .PARAMETER UDP...
combined_dataset/train/non-malicious/sample_44_22.ps1
sample_44_22.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 = '79.0.0' # Supported PSEditions Compatible...
combined_dataset/train/non-malicious/finddupe_9.ps1
finddupe_9.ps1
function Get-MD5([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]')) { $stream = $null; $cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider]; $hashAlgorithm = new-object $cryptoServiceProvider $stream = $file.OpenRead(); $hashByteArray = $hashA...
combined_dataset/train/non-malicious/ISE-Snippets variant.ps1
ISE-Snippets variant.ps1
#requires -version 2.0 ## ISE-Snippets module v 1.0 ## DEVELOPED FOR CTP3 ## See comments for each function for changes ... ############################################################################################################## ## As a shortcut for every snippet would be to much, I created Add-Snippet whic...
combined_dataset/train/non-malicious/sample_24_53.ps1
sample_24_53.ps1
# Copyright (C) Intel Corporation, 2021 All Rights Reserved. <# .Synopsis Invokes the Intel Active Management Technology force boot command using the One-Click Recovery boot options .Description This cmdlet invokes the Intel Active Management Technology force boot command using the One-Click Recover...
combined_dataset/train/non-malicious/0220791d-2756-4988-aca9-8cfa1366a66c.ps1
0220791d-2756-4988-aca9-8cfa1366a66c.ps1
param ([string]$recursePath= $(Throw "Du mň spesifisere ei mappe!")) function build-word-docs($recursePath) { # $dir = "C:\\Users\\bjorninge\\Documents\\My Dropbox\\mafo-bjorn\\bachelor-prosjekt\\Driftsdokumentasjon" $oldDir = get-location cd $recursePath $files = ls -Recurse | where {$_.extensio...