full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/sample_32_64.ps1
sample_32_64.ps1
# Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved. Function Set-AMTAlarmClock { <# .Synopsis Sets a Intel Active Management Technology alarm clock timer .Description This CmdLet allows the user to set a wake timer on clients that have Intel Active Management Technology (AMT) firmwa...
combined_dataset/train/non-malicious/sample_64_78.ps1
sample_64_78.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 Publish-UpgradedServ...
combined_dataset/train/non-malicious/1800.ps1
1800.ps1
Describe "Pop-Location" -Tags "CI" { $startDirectory = $(Get-Location).Path BeforeEach { Set-Location $startDirectory } It "Should be able to be called without error" { { Pop-Location } | Should -Not -Throw } It "Should not take a parameter" { { Pop-Location .. } | Should -Throw } It...
combined_dataset/train/non-malicious/sample_23_99.ps1
sample_23_99.ps1
$global:VerbosePreference = 'Continue' Function Write-Custom-Output { Param([string]$message) $date = Get-Date $newMessage = '[{0}] {1}' -f $date, $message Write-Output $newMessage } trap [Exception] { Write-Custom-Output "WARN: Terminating error encountered on line $($_.Invoc...
combined_dataset/train/non-malicious/sample_0_51.ps1
sample_0_51.ps1
ConvertFrom-StringData @' id_msinfo32=System Information id_msinfo32running=Running MSInfo32 utility to obtain system information (TXT and NFO) '@ # SIG # Begin signature block # MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG ...
combined_dataset/train/non-malicious/sample_59_42.ps1
sample_59_42.ps1
# --------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # ---------------------------------------------------------------...
combined_dataset/train/non-malicious/Set-PowerGUIWelcomePage_2.ps1
Set-PowerGUIWelcomePage_2.ps1
######################################################## # Modifies the default PowerGUI admin console # welcome screen to the mht file you supply # Details available at: # http://dmitrysotnikov.wordpress.com/2009/02/11/rebranding-powergui-consolerebranding-powergui-console/ ######################################...
combined_dataset/train/non-malicious/165.ps1
165.ps1
function Connect-Office365 { [CmdletBinding()] PARAM () BEGIN { TRY { IF (-not (Get-Module -Name MSOnline -ListAvailable)) { Write-Verbose -Message "BEGIN - Import module Azure Active Directory" Import-Module -Name MSOnline -ErrorAction Stop -ErrorVariable ErrorBeginIpmoMSOnline } IF (...
combined_dataset/train/non-malicious/Get-MountPointInfo.ps1
Get-MountPointInfo.ps1
function Get-MountPointInfo { <# .Synopsis Get mount point volume free space information .Parameter Name Name of the system to query .Parameter Credential The Credentals to use when adding the system .Example Get-MountPointInfo -Name "Server1","Server2" -Cred...
combined_dataset/train/non-malicious/301.ps1
301.ps1
function Start-PSFRunspace { [CmdletBinding(SupportsShouldProcess = $true, HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Start-PSFRunspace')] Param ( [Parameter(ValueFromPipeline = $true)] [string[]] $Name, [Parameter(ValueFromPipeline = $true)] [PSFramework.Runspace.RunspaceCont...
combined_dataset/train/non-malicious/sample_43_9.ps1
sample_43_9.ps1
# region Generated # Load the private module dll $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Security.private.dll') # Get the private module's instance $instance = [Microsoft.Azure.PowerShell.Cmdlets.Security.Module]::Instance # Export nothing to clear implicit exports ...
combined_dataset/train/non-malicious/2794.ps1
2794.ps1
if (Get-Command logparser.exe) { $lpquery = @" SELECT COUNT(ProcessName) as ct, ProcessName FROM *ProcsWMI.tsv GROUP BY ProcessName ORDER BY ct ASC "@ & logparser -stats:off -i:csv -dtlines:0 -fixedsep:on -rtp:-1 "$lpquery" } else { $ScriptName = [...
combined_dataset/train/non-malicious/sample_35_43.ps1
sample_35_43.ps1
# # Module manifest for module 'OCI.PSModules.Streaming' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Streaming.dll' # Version number of this module. ModuleVersion = '83.1.0' # Supported PSEditions Co...
combined_dataset/train/non-malicious/sample_12_90.ps1
sample_12_90.ps1
# # Module manifest for module 'OCI.PSModules.Osmanagement' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Osmanagement.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEditi...
combined_dataset/train/non-malicious/sample_67_84.ps1
sample_67_84.ps1
# # Module manifest for module 'OCI.PSModules.Events' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Events.dll' # Version number of this module. ModuleVersion = '87.0.0' # Supported PSEditions Compatib...
combined_dataset/train/non-malicious/519.ps1
519.ps1
function Get-SPListFiles{ param( ) Get-SPSite | %{ $SPsite = $_ $SPsite.RecycleBin | where{$_.ItemType -eq "File"} |%{ $ItemUrl = $SPsite.Url + "/" + $_.DirName + "/"+ $_.LeafName New-Object PSObject -Property @{ ...
combined_dataset/train/non-malicious/378.ps1
378.ps1
Describe "Set-PSFConfig Unit Tests" -Tag "CI","Config","Unit" { BeforeAll { Get-PSFConfig -Module PSFTests -Force | ForEach-Object { $null = [PSFramework.Configuration.ConfigurationHost]::Configurations.Remove($_.FullName) } $global:handler = "Did not run" } AfterAll { Get-PSFConfig -Module PSFTests -Forc...
combined_dataset/train/non-malicious/Export-PSCredential.ps1
Export-PSCredential.ps1
# Author: Hal Rottenberg <hal@halr9000.com> # Url: http://halr9000.com/article/tag/lib-authentication.ps1 # Purpose: These functions allow one to easily save network credentials to disk in a relatively # secure manner. The resulting on-disk credential file can only [1] be decrypted # by the same user account...
combined_dataset/train/non-malicious/sample_60_7.ps1
sample_60_7.ps1
New-Alias -Name 'pad' -Value 'Show-PSScriptPad' -Force $Platform = 'windows' if ($IsLinux) { $Platform = 'linux' } elseif ($IsMacOS) { $Platform = 'mac' } $Runtime = "net472" if ($IsCoreCLR) { if ($PSVersionTable.PSVersion.Major -eq 7 -and $PSVersionTable.PSVersion.Minor -ge 1) { $Run...
combined_dataset/train/non-malicious/3459.ps1
3459.ps1
function Test-SelfHosted-IntegrationRuntime { $dfname = Get-DataFactoryName $rgname = Get-ResourceGroupName $rglocation = Get-ProviderLocation ResourceManagement $dflocation = Get-ProviderLocation DataFactoryManagement New-AzResourceGroup -Name $rgname -Location $rglocation -F...
combined_dataset/train/non-malicious/sample_64_5.ps1
sample_64_5.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 Remove-ServiceFabric...
combined_dataset/train/non-malicious/sample_16_64.ps1
sample_16_64.ps1
function New-PlasterManifest { [CmdletBinding(SupportsShouldProcess=$true)] param( [Parameter()] [ValidateNotNullOrEmpty()] [string] $Path = "$pwd\plasterManifest.xml", [Parameter(Mandatory=$true)] [ValidatePattern('^[0-9a-zA-Z_-]+$')] [string] $T...
combined_dataset/train/non-malicious/50.ps1
50.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 ($Aa...
combined_dataset/train/non-malicious/2366.ps1
2366.ps1
[CmdletBinding(DefaultParameterSetName = 'CSV')] [OutputType('System.Management.Automation.PSCustomObject')] param ( [hashtable]$AdToSourceFieldMappings = @{ 'givenName' = 'FirstName'; 'Initials' = 'MiddleInitial'; 'surName' = 'LastName' }, [hashtable]$AdToOutputFieldMappings = @{ 'givenName' = 'AD First Name'; 'Ini...
combined_dataset/train/non-malicious/1711.ps1
1711.ps1
function Set-ServiceNowAuth { [CmdletBinding()] Param ( [Parameter(Mandatory = $true)] [ValidateScript({Test-ServiceNowURL -Url $_})] [Alias('ServiceNowUrl')] [string]$Url, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [System.Management.Auto...
combined_dataset/train/non-malicious/sample_17_32.ps1
sample_17_32.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 = '80.0.0' # Supported PSEditi...
combined_dataset/train/non-malicious/Get-VariableType.ps1
Get-VariableType.ps1
function Get-VariableType { param([string]$Name) get-variable $name | select -expand attributes | ? { $_.gettype().name -eq "ArgumentTypeConverterAttribute" } | % { $_.gettype().invokemember("_convertTypes", "NonPublic,Instance,GetField", $null, $_, @()) } }
combined_dataset/train/non-malicious/Manage ASP.NET Providers.ps1
Manage ASP.NET Providers.ps1
# Manage_ASP_NET_Providers.ps1 # by Chistian Glessner # http://iLoveSharePoint.com [void][System.Reflection.Assembly]::LoadWithPartialName("System.Web") # posh 2.0: Add-Type -Assembly "System.Web" function global:Set-AppConfigPath($path=$(throw "-path is mandatory")) { [System.AppDomain]::CurrentDomain.Se...
combined_dataset/train/non-malicious/Get User for Svc_Tasks.ps1
Get User for Svc_Tasks.ps1
#========================================================================== # NAME: GetServiceAndTaskAccounts.ps1 # # AUTHOR: Stephen Wheet # Version: 2.0 # Date: 7/21/10 # # COMMENT: # This script was created to find out which any which services on any of # the servers are running as domain accounts. It ...
combined_dataset/train/non-malicious/sample_45_82.ps1
sample_45_82.ps1
# # Module manifest for module 'OCI.PSModules.Apigateway' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Apigateway.dll' # Version number of this module. ModuleVersion = '83.2.0' # Supported PSEditions ...
combined_dataset/train/non-malicious/sample_23_88.ps1
sample_23_88.ps1
function GetDatasourceSetInfo { [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.DoNotExportAttribute()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20240401.IDatasource] $DatasourceInfo, [Parameter(Mandatory=$true...
combined_dataset/train/non-malicious/Exchange Mailbox report.ps1
Exchange Mailbox report.ps1
function Send-SMTPmail($to, $from, $subject, $smtpserver, $body) { $mailer = new-object Net.Mail.SMTPclient($smtpserver) $msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body) $msg.IsBodyHTML = $true $mailer.send($msg) } Function Get-CustomHTML ($Header){ $Report = @" <!DOCTYPE HTML PUBLIC "-//W...
combined_dataset/train/non-malicious/3432.ps1
3432.ps1
[CmdletBinding(DefaultParameterSetName="ReleaseAz")] Param( [Parameter(ParameterSetName='ReleaseAz', Mandatory = $true)] [string]$Release, [Parameter(ParameterSetName='ReleaseSingleModule', Mandatory = $true)] [string]$ModuleName, [Parameter()] [string]$GalleryName = "PSGallery" ) enum PSVe...
combined_dataset/train/non-malicious/3138.ps1
3138.ps1
$Object = [pscustomobject]@{ Number1 = '1' Number2 = '2' } $object.PSObject.TypeNames.Insert(0,'Number.Information') $DefaultDisplaySet = 'Number1' $DefaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet',[string[]]$DefaultDisplaySet) $PSStandardMembe...
combined_dataset/train/non-malicious/sample_43_65.ps1
sample_43_65.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/3293.ps1
3293.ps1
[cmdletbinding()] param( [parameter(Mandatory)] [ValidateScript({ if (Test-Path -Path $_) { if ( (Get-Item -Path $_).Extension -eq '.psd1') { $true } else { Throw 'Path must be to a valid .psd1 file' } } else { Throw...
combined_dataset/train/non-malicious/Get-Parameter _1.5.ps1
Get-Parameter _1.5.ps1
#Requires -version 2.0 #.Synopsis # Enumerates the parameters of one or more commands #.Notes # With many thanks to Hal Rottenberg, Oisin Grehan and Shay Levy # Version 0.80 - April 2008 - By Hal Rottenberg http://poshcode.org/186 # Version 0.81 - May 2008 - By Hal Rottenberg http://poshcode.org/255 # Ver...
combined_dataset/train/non-malicious/sample_19_95.ps1
sample_19_95.ps1
@{ GUID="EEFCB906-B326-4E99-9F54-8B4BB6EF3C6D" Author="PowerShell" CompanyName="Microsoft Corporation" Copyright="Copyright (c) Microsoft Corporation." ModuleVersion="7.0.0.0" CompatiblePSEditions = @("Core") PowerShellVersion="3.0" NestedModules="Microsoft.PowerShell.Commands.Management.dll" HelpInfoURI = 'https://aka...
combined_dataset/train/non-malicious/2163.ps1
2163.ps1
function Load-Form { $Form.Controls.AddRange(@($MainTabControl, $ButtonStart, $ButtonValidate, $SBStatus, $OutputBox, $GBOutputBox)) $MainTabControl.Controls.AddRange(@($TabPageSetup, $TabPageMDT, $TabPageWSUS, $TabPageApplications, $TabPageOS)) $TabPageSetup.Controls.AddRange(@($CMBGeneralOptionModeOS, $CMBGe...
combined_dataset/train/non-malicious/sample_30_74.ps1
sample_30_74.ps1
ConvertFrom-StringData @' EnvironmentErrorAlreadyExists=Una variabile di ambiente dello stesso tipo e con questo nome esiste già. EnvironmentErrorDoesNotExists=Una variabile di ambiente dello stesso tipo e con questo nome non esiste. '@ # SIG # Begin signature block # MIIoLAYJKoZIhvcNAQcCoIIoHTCCKBkCAQExDzANBglg...
combined_dataset/train/non-malicious/HelpModules 2.0.ps1
HelpModules 2.0.ps1
# HelpModules # A Module for generating module stubs so you can Update-Help (or Save-Help) # Includes two options for reading the help from those modules (StubFunctions or Get-ModuleHelp) # 1.0 - 2013/2/1 - Initial release Friday, Feb 1st, 2013 # 2.0 - 2013/2/1 - Updated release with improved pipeline/remot...
combined_dataset/train/non-malicious/Seach-LocalGroupMemberDo.ps1
Seach-LocalGroupMemberDo.ps1
function Seach-LocalGroupMemberDomenNetwork() { param( $Domen, $User ) function Ping ($Name){ $ping = new-object System.Net.NetworkInformation.Ping if ($ping.send($Name).Status -eq "Success") {$True} else {$False} trap {Write-Verbose "&#1054;&#1096;&#1080;&#1073;&#1082;&#1072; &#1087;&#1080;&#...
combined_dataset/train/non-malicious/JSON 1.3.ps1
JSON 1.3.ps1
#requires -version 2.0\n# Version History:\n# v 0.5 - First Public version\n# v 1.0 - Made ConvertFrom-Json work with arbitrary JSON \n# - switched to xsl style sheets for ConvertTo-JSON\n# v 1.1 - Changed ConvertFrom-Json to handle single item results\n# v 1.2 - CodeSigned to make a fellow geek happy\n# v 1.3 - ...
combined_dataset/train/non-malicious/Get-DLRestriction.ps1
Get-DLRestriction.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/1290.ps1
1290.ps1
function Remove-CEnvironmentVariable { [CmdletBinding(SupportsShouldProcess=$true)] param( [Parameter(Mandatory=$true)] [string]$Name, [Parameter(ParameterSetName='ForCurrentUser')] [Switch]$ForComputer, [Parameter(ParameterSetName='ForCu...
combined_dataset/train/non-malicious/sample_36_94.ps1
sample_36_94.ps1
description = 'reactive-streams-examples' dependencies { implementation project(':reactive-streams') testImplementation project(':reactive-streams-tck') } jar { bnd ('Bundle-Name': 'reactive-streams-jvm', 'Bundle-Vendor': 'Reactive Streams SIG', 'Bundle-Description': 'Reactive Strea...
combined_dataset/train/non-malicious/Set-IPAddress_3.ps1
Set-IPAddress_3.ps1
function Set-IPAddress { param( [string]$networkinterface =$(read-host "Enter the name of the NIC (ie Local Area Connection)"), [string]$ip = $(read-host "Enter an IP Address (ie 10.10.10.10)"), [string]$mask = $(read-host "Enter the subnet mask (ie 255.255.255.0)"), [string]$gateway = $(read-host "Enter...
combined_dataset/train/non-malicious/finddupe_19.ps1
finddupe_19.ps1
# new version has more error handling, "-delete" and "-noprompt" and "-recurse" options. function Get-MD5([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]')) { $stream = $null; $cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider]; $hashAlgorithm = new...
combined_dataset/train/non-malicious/1286.ps1
1286.ps1
function Find-CADUser { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string] $DomainUrl, [Parameter(Mandatory=$true,ParameterSetName='BysAMAccountName')] [string] $sAMAccountName ) Set-StrictMode -Ver...
combined_dataset/train/non-malicious/1457.ps1
1457.ps1
function Test-CDotNet { [CmdletBinding()] param( [Parameter(Mandatory=$true,ParameterSetName='v2')] [Switch] $V2, [Parameter(Mandatory=$true,ParameterSetName='v4Client')] [Parameter(Mandatory=$true,ParameterSetName='v4Full')] [Switch] ...
combined_dataset/train/non-malicious/sample_16_20.ps1
sample_16_20.ps1
@{ GUID = "1DA87E53-152B-403E-98DC-74D7B4D63D59" Author = "PowerShell" CompanyName = "Microsoft Corporation" Copyright = "Copyright (c) Microsoft Corporation." ModuleVersion = "7.0.0.0" CompatiblePSEditions = @("Core") PowerShellVersion = "3.0" CmdletsToExport = @( 'Export-Alias', 'Get-Alias', 'Import-Alias', 'New-Al...
combined_dataset/train/non-malicious/sample_24_19.ps1
sample_24_19.ps1
# # Module manifest for module 'OCI.PSModules.Dataintegration' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Dataintegration.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported P...
combined_dataset/train/non-malicious/WhileTimeout.ps1
WhileTimeout.ps1
function WhileTimeout ( [int]$interval, [int]$maxTries, [scriptblock]$condition ) { $i = 0 $startTime = Get-Date while ( &$condition ) { $i++ if ( $i -lt $maxTries ) { Start-Sleep -seconds $interval } else { Throw "Operation exceeded timeout" } } $endTime = Get-Date $duration = ( $endTi...
combined_dataset/train/non-malicious/sample_10_36.ps1
sample_10_36.ps1
'This script has been deprecated. Please use the PowerShell version TS_Virtualization.ps1 '' SIG '' Begin signature block '' SIG '' MIIoUAYJKoZIhvcNAQcCoIIoQTCCKD0CAQExDzANBglg '' SIG '' hkgBZQMEAgEFADB3BgorBgEEAYI3AgEEoGkwZzAyBgor '' SIG '' BgEEAYI3AgEeMCQCAQEEEE7wKRaZJ7VNj+Ws4Q8X66sC '' SIG '' AQACAQACAQACAQAC...
combined_dataset/train/non-malicious/2446.ps1
2446.ps1
configuration NewPullServer { param ( [string[]]$ComputerName = ‘localhost’ ) Import-DSCResource -ModuleName xPSDesiredStateConfiguration Node $ComputerName { WindowsFeature DSCServiceFeature { Ensure = “Present” Name = “DSC-Service” } xDscWeb...
combined_dataset/train/non-malicious/3008.ps1
3008.ps1
if ($PSVersionTable.PSVersion.Major -le 2) { function Exit-CoverageAnalysis { } function Get-CoverageReport { } function Write-CoverageReport { } function Enter-CoverageAnalysis { param ( $CodeCoverage ) if ($CodeCoverage) { & $SafeCommands['Write-Error'] 'Code coverage anal...
combined_dataset/train/non-malicious/1300.ps1
1300.ps1
function Install-CGroup { [CmdletBinding(SupportsShouldProcess=$true)] [OutputType([DirectoryServices.AccountManagement.GroupPrincipal])] param( [Parameter(Mandatory=$true)] [string] $Name, [string] $Description = '', ...
combined_dataset/train/non-malicious/1445.ps1
1445.ps1
function Get-CUser { [CmdletBinding()] [OutputType([System.DirectoryServices.AccountManagement.UserPrincipal])] param( [ValidateLength(1,20)] [string]$UserName ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.Se...
combined_dataset/train/non-malicious/Set-WinSchedule_2.ps1
Set-WinSchedule_2.ps1
# Set-WinSchedule # Written by Tome Tanasovski # http://powertoe.wordpress.com # version 1.0 # Created March 2010 # # Please read through the synopsis->Description to see the list of features that I hope to get # in a final release. If you choose to work on any of the issues by all means, but please contact #...
combined_dataset/train/non-malicious/Set-TopMost_2.ps1
Set-TopMost_2.ps1
#Requires -Version 2.0 $signature = @" [DllImport("user32.dll")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); public static IntPtr FindWindow(string windowName){ return FindWindow(null,windowName); } [DllImport("user32.dll")] public static extern bool Se...
combined_dataset/train/non-malicious/1680.ps1
1680.ps1
Function Test-RPC { [CmdletBinding(SupportsShouldProcess=$True)] Param([Parameter(ValueFromPipeline=$True)][String[]]$ComputerName = 'localhost') BEGIN { Set-StrictMode -Version Latest $PInvokeCode = @' using System; using System.Collections.Generic; using Syst...
combined_dataset/train/non-malicious/2583.ps1
2583.ps1
Import-Module SqlServer Import-Module Pscx $sql = "PSQLRPT24" $db = "PA_DMart" $DirectoryToSaveTo='e:\Dexma\Logs\' if (!(Test-Path -path "$DirectoryToSaveTo")) { New-Item "$DirectoryToSaveTo" -type directory | out-null } $filename = $DirectoryToSaveTo + "Test File.xlsx" if (test-path $filename) { rm $filename } ...
combined_dataset/train/non-malicious/Amazon AWS user data.ps1
Amazon AWS user data.ps1
<powershell> $ComputerName = $env:COMPUTERNAME $user = [adsi]"WinNT://$ComputerName/Administrator,user" $user.setpassword("Password") </powershell>
combined_dataset/train/non-malicious/3001.ps1
3001.ps1
Set-StrictMode -Version Latest function f () {} Mock f {} Describe 'Mock at script scope' { It 't' { 1 | Should -Be 1 } }
combined_dataset/train/non-malicious/155.ps1
155.ps1
Function Get-Something { PARAM ( [Alias("CN", "__SERVER", "PSComputerName")] [String[]]$ComputerName = $env:COMPUTERNAME, [Alias("RunAs")] [System.Management.Automation.Credential()] [pscredential] $Credential = [System.Management.Automation.PSCredential]::Empty ...
combined_dataset/train/non-malicious/1124.ps1
1124.ps1
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve) Describe 'Get-FileSharePermission' { $shareName = 'CarbonGetFileSharePermission' $sharePath = $null $reader = 'CarbonFileShareReadr' $writer = 'CarbonFileShareWritr' $admin = 'CarbonFileShareAdmin' $...
combined_dataset/train/non-malicious/sample_59_6.ps1
sample_59_6.ps1
# # Module manifest for module 'DscInstall' # # Generated by: Zia Jalali # # Generated on: 07/31/2017 # @{ # Script module or binary module file associated with this manifest. ModuleToProcess = 'Heartbeat.psm1' # Version number of this module. ModuleVersion = '1.1' # ID used to uniquely identify thi...
combined_dataset/train/non-malicious/sample_25_20.ps1
sample_25_20.ps1
const VscctService = require("../../VscctService"); const removeAccents = str => str.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); module.exports = class ScheduledTasksFilesService extends VscctService { /** * * @param {import("../ScheduledTasksService").ScheduledTaskGroup} scheduling ...
combined_dataset/train/non-malicious/620.ps1
620.ps1
param( [string]$Version, [string]$Path, [switch]$Force, $Update, [switch]$Uninstall ) $Configs = @{ Url = "http://nodejs.org/dist/v0.10.26/x64/node-v0.10.26-x64.msi" Path = "$(Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)\" } $Configs | ForEach-Object{ try{ $_.Result = $null...
combined_dataset/train/non-malicious/sample_9_69.ps1
sample_9_69.ps1
ConvertFrom-StringData @' id_ctssnmp=SNMP id_ctssnmpdescription=Collects information about SNMP. '@ # SIG # Begin signature block # MIIoOQYJKoZIhvcNAQcCoIIoKjCCKCYCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCA...
combined_dataset/train/non-malicious/sample_63_98.ps1
sample_63_98.ps1
# # Module manifest for module 'OCI.PSModules.Goldengate' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Goldengate.dll' # Version number of this module. ModuleVersion = '86.2.0' # Supported PSEditions ...
combined_dataset/train/non-malicious/sample_43_39.ps1
sample_43_39.ps1
function Get-RepoName { [CmdletBinding()] param( [Parameter()] [switch]$Origin ) process { $clone = Get-GitUrl -Origin:$Origin if ($clone -match "(?mi)^git@github.com:(?<owner>[^/]+)/(?<reponame>.+)\.git") { return $matches.RepoName } ...
combined_dataset/train/non-malicious/1893.ps1
1893.ps1
Describe "ConvertFrom-SddlString Tests" -Tags "CI", "RequireAdminOnWindows" { BeforeAll { if (-not $IsWindows) { return } $sddl = (Get-Item -Path WSMan:\localhost\Service\RootSDDL).Value $testCases = @( @{ Type = "_UNSPECIFIED_" } @{ Type = "FileSystemRights" } ...
combined_dataset/train/non-malicious/sample_66_38.ps1
sample_66_38.ps1
# ------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See License.txt in the repo root for license information. # ------------------------------------------------------------ [CmdletBinding(DefaultParamet...
combined_dataset/train/non-malicious/326.ps1
326.ps1
function Select-PSFPropertyValue { [CmdletBinding(DefaultParameterSetName = 'Default')] param ( [Parameter(Mandatory = $true, Position = 0)] [string[]] $Property, [Parameter(ParameterSetName = 'Fallback')] [switch] $Fallback, [Parameter(ParameterSetName = 'Select')] [ValidateSet('Lowest', 'Larg...
combined_dataset/train/non-malicious/sample_34_90.ps1
sample_34_90.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 = '74.1.0' # Supported PSEditions Compatib...
combined_dataset/train/non-malicious/sample_5_59.ps1
sample_5_59.ps1
#************************************************ # DC_GetSQLSetupLogs.ps1 # Version 1.0.0 # Date: 8-19-2011 # Author: Shon Hauck - Shonh@Microsoft.com # Description: Used to Get SQL Setup Logs (Bootstrap Directory for SQL 9, 10 , 10.5, 11) # # Date: 4-15-2020 # Modified By: João Polisel - JPolisel@Microsoft.co...
combined_dataset/train/non-malicious/sample_23_40.ps1
sample_23_40.ps1
# # Module manifest for module 'OCI.PSModules.Cims' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Cims.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEditions CompatiblePS...
combined_dataset/train/non-malicious/RunSSIS_1.ps1
RunSSIS_1.ps1
# --------------------------------------------------------------------------- ### <Script> ### <Author> ### Chad Miller ### </Author> ### <Description> ### Executes SSIS package for both server and file system storage types. ### </Description> ### <Usage> ### -------------------------- EXAMPLE 1 ------------...
combined_dataset/train/non-malicious/AS function.ps1
AS function.ps1
#region setup AS function function new-selectexpression { if ($args.count -eq 1) { $theargs = $args[0] } else {$theargs= $args } if ($theargs.count -gt 1) { for($loop=0;$loop -lt ($theargs.count-1);$loop+=2) { @{Name=$theargs[$loop];Expression=$theargs[$loop+1]} } } if (!($theargs.count % 2) -eq 0) {@{...
combined_dataset/train/non-malicious/sample_41_67.ps1
sample_41_67.ps1
$url = $args[0] Write-Host "Downloading Microsoft Edge Dev" $wc = New-Object net.webclient $msiInstaller = "$env:temp\microsoft-edge-dev.msi" $wc.Downloadfile($url, $msiInstaller) Write-Host "Installing Microsoft Edge Dev" $arguments = "/i `"$msiInstaller`" /quiet" Start-Process msiexec.exe -ArgumentList $arguments -...
combined_dataset/train/non-malicious/sample_62_59.ps1
sample_62_59.ps1
# # Module manifest for module 'Azs.Deployment.Worksheet' # # Generated by: Microsoft Corporation # # Generated on: 10/30/2018 # @{ # Script module or binary module file associated with this manifest. RootModule = 'Azs.Deployment.Worksheet.psm1' # Version number of this module. ModuleVers...
combined_dataset/train/non-malicious/2152.ps1
2152.ps1
param ( [switch]$Force, [switch]$UseExistingMsi ) $script:Constants = @{ AccountName = 'PowerShell' ProjectName = 'powershell-f975h' TestImageName = "remotetestimage" MsiName = "PSCore.msi" Token = "" } $dockerExe = get-command docker -ea silentlycontinue if ( $dockerEx...
combined_dataset/train/non-malicious/Basic DNSBL Check for IP.ps1
Basic DNSBL Check for IP.ps1
Function CheckDNSBL { <# .NOTES AUTHOR: Sunny Chakraborty(sunnyc7@gmail.com) WEBSITE: http://tekout.wordpress.com VERSION: 0.1 CREATED: 16th July, 2012 LASTEDIT: 16th July, 2012 Requires: PowerShell v2 or better .DESCRIPTION Basic Proof of Concept DNSBL Check Script You can add your own DN...
combined_dataset/train/non-malicious/sample_40_25.ps1
sample_40_25.ps1
BeforeAll { $ModuleManifestName = 'SampleModule.psd1' Import-Module $PSScriptRoot\..\$ModuleManifestName } Describe 'Module Manifest Tests' { It 'Passes Test-ModuleManifest' { Test-ModuleManifest -Path $PSScriptRoot\..\$ModuleManifestName $? | Should -Be $true } } # SIG # Beg...
combined_dataset/train/non-malicious/sample_47_7.ps1
sample_47_7.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_9_2.ps1
sample_9_2.ps1
. ./utils_cts.ps1 SkipSecondExecution $ClusterKey="HKLM:\Cluster" if (Test-Path $ClusterKey) { Import-Module FailoverClusters $SharedVolumesRedirected_Summary = new-object PSObject $SharedVolumesRedirected = Get-ClusterSharedVolume | Where-Object {$_.SharedVolumeInfo[0].RedirectedAccess} foreach (...
combined_dataset/train/non-malicious/4082.ps1
4082.ps1
[CmdletBinding()] param () function Get-Architecture { [CmdletBinding()][OutputType([string])] param () $OSArchitecture = Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture $OSArchitecture = $OSArchitecture.OSArchitecture Return $OSArchitecture } function Get-MSIInformation { [...
combined_dataset/train/non-malicious/Get-WebFile 3.7.3.ps1
Get-WebFile 3.7.3.ps1
## Get-WebFile (aka wget for PowerShell) ############################################################################################################## ## Downloads a file or page from the web ## History: ## v3.7.3 - Checks to see if URL is formatted properly (contains http or https) ## v3.7.2 - Puts a try-catch b...
combined_dataset/train/non-malicious/sample_34_48.ps1
sample_34_48.ps1
# ------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See License.txt in the repo root for license information. # ------------------------------------------------------------ [CmdletBinding(DefaultParamet...
combined_dataset/train/non-malicious/2671.ps1
2671.ps1
Function Install-SharePointPnPPowerShellModule { param ( [Parameter(Mandatory=$true,HelpMessage='Online is for SharePoint Online, SP2013 for SharePoint 2013 and SP2016 for SharePoint 2016')] [ValidateSet('Online','SP2013','SP2016')] [string] $ModuleToInstall ) switch...
combined_dataset/train/non-malicious/Rotate-Right.ps1
Rotate-Right.ps1
function Rotate-Right { <# .SYNOPSIS Performs a binary rotate right operation. Author: Matthew Graeber (@mattifestation) .DESCRIPTION Rather than implementing the logic to perform a binary rotate operation, Rotate-Right wraps the private methods contained within System.Security.Cryptography.SHA256Managed and ...
combined_dataset/train/non-malicious/sample_15_93.ps1
sample_15_93.ps1
#************************************************ # DC_ExchangeServerEventLogs.ps1 # Version 1.2.0 # Date: 2013-05-21 # Author: Brian Prince - brianpr@microsoft.com # Description: This script calls TS_GetEvents.ps1 to export Exchange Server and backup -related event logs #*****************************************...
combined_dataset/train/non-malicious/309.ps1
309.ps1
function Set-PSFTeppResult { [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low', HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Set-PSFTeppResult')] param ( [Parameter(Mandatory = $true)] [PSFramework.Validation.PsfValidateSetAttribute(ScriptBlock = { [PSFramework.TabExpan...
combined_dataset/train/non-malicious/sample_46_86.ps1
sample_46_86.ps1
<################################################### # # # Copyright (c) Microsoft. All rights reserved. # # # ##################################################> <# .SYNOPSIS Purpose: Creates a .zip file of a...
combined_dataset/train/non-malicious/472.ps1
472.ps1
function Get-PPScript{ [CmdletBinding()] param( [Parameter(Mandatory=$false)] [String] $Name, [Switch] $Shortcut ) $ScriptShortcuts = Get-ChildItem -Path $PSconfigs.Path -Filter $PSconfigs.ScriptShortcut.DataFile -Recurse | %{[xml](Ge...
combined_dataset/train/non-malicious/Test-VM.ps1
Test-VM.ps1
Function Test-VM { [cmdletbinding()] Param ( [Parameter(Mandatory=$true,Position=1)] [string[]]$Name, [Parameter(Mandatory=$true,Position=2)] [string[]]$ComputerName ) Process { $results = @() foreach ($cName in $ComputerName) { ...
combined_dataset/train/non-malicious/sample_11_29.ps1
sample_11_29.ps1
#!/usr/bin/env pwsh $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent $exe="" $pathsep=":" $env_node_path=$env:NODE_PATH $new_node_path="C:\Users\abder\component-maker\web\node_modules\.pnpm\nanoid@3.3.7\node_modules\nanoid\bin\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\nanoid@3.3....
combined_dataset/train/non-malicious/playlist_1.com music cache.ps1
playlist_1.com music cache.ps1
function calculateurl ([string]$source) { $encoded = ([byte[]]([regex]::matches($source,'\\w{2}') |% {"0x$_"})) $a = 0 $sbox = 0..255 $seed = "sdf883jsdf22"; $mykey = 0..255 | % { ([byte[]] ($seed.tochararray()))[$_ % $seed.length] } 0..255 | % {$a = ($a + $sbox[$_] + $mykey[$_]) % 256;$b = $sbox[$_];$sbox...
combined_dataset/train/non-malicious/Get_Set Signature (CTP2).ps1
Get_Set Signature (CTP2).ps1
#requires -version 2.0 CMDLET Set-AuthenticodeSignature -snapin Huddled.BetterDefaults { PARAM ( [Parameter(Position=1, Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Alias("FullName")] [ValidateScript({ if((resolve-path .\\breaking.ps1).Provider.Name -ne "FileSystem") { thro...