full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/sample_51_52.ps1
sample_51_52.ps1
# region Generated # Load the private module dll $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.MonitorWorkspace.private.dll') # Load the internal module $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.MonitorWorkspace.internal.psm1' if(Test-Path $internalModul...
combined_dataset/train/non-malicious/sample_20_19.ps1
sample_20_19.ps1
# # Module manifest for module 'OCI.PSModules.Loganalytics' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Loganalytics.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported PSEditi...
combined_dataset/train/non-malicious/3298.ps1
3298.ps1
function Get-PoshBotStatefulData { [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Scope='Function', Target='*')] [cmdletbinding()] param( [string]$Name = '*', [switch]$ValueOnly, [validateset('Global','Module')] [string]$Scope = 'Mo...
combined_dataset/train/non-malicious/3266.ps1
3266.ps1
class CommandExecutor : BaseLogger { [RoleManager]$RoleManager hidden [Bot]$_bot [int]$HistoryToKeep = 100 [int]$ExecutedCount = 0 [System.Collections.ArrayList]$History = (New-Object System.Collections.ArrayList) hidden [hashtable]$_jobTracker = @{} CommandExecutor([...
combined_dataset/train/non-malicious/HttpRest 1.0.1.ps1
HttpRest 1.0.1.ps1
## Http Rest #################################################################################################### ## The first implementation of the HttpRest module, as a bunch of script functions ## Based on the REST api from MindTouch's Dream SDK ## ## INSTALL: ## You need log4net.dll mindtouch.core.dll mindto...
combined_dataset/train/non-malicious/Get-Netstat 1,3.ps1
Get-Netstat 1,3.ps1
$null, $null, $null, $null, $netstat = netstat -a -n -o $ps = Get-Process [regex]$regexTCP = '(?<Protocol>\\S+)\\s+(?<LAddress>\\S+):(?<LPort>\\S+)\\s+(?<RAddress>\\S+):(?<RPort>\\S+)\\s+(?<State>\\S+)\\s+(?<PID>\\S+)' [regex]$regexUDP = '(?<Protocol>\\S+)\\s+(?<LAddress>\\S+):(?<LPort>\\S+)\\s+(?<RAddress>\\S+):(?<...
combined_dataset/train/non-malicious/sample_44_88.ps1
sample_44_88.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 = '83.1.0' # Supported PSEditi...
combined_dataset/train/non-malicious/1914.ps1
1914.ps1
Describe "Get-Culture" -Tags "CI" { It "Should return a type of CultureInfo for Get-Culture cmdlet" { $culture = Get-Culture $culture | Should -BeOfType [CultureInfo] ($culture).EnglishName | Should -BeExactly $host.CurrentCulture.EnglishName Get-Culture -NoUserOverrides | Shou...
combined_dataset/train/non-malicious/sample_29_20.ps1
sample_29_20.ps1
# Web Deploy: Powershell script which contains common functionality for other scripts to reference. # Copyright (C) Microsoft Corp. 2010 # # Requirements: IIS 7, Windows Server 2008 (or higher) # Import-LocalizedData -BindingVariable Resources -FileName Resources.psd1 #constants $Global:ScriptError = 0 $Glo...
combined_dataset/train/non-malicious/Xml Module 6.2.ps1
Xml Module 6.2.ps1
#requires -version 2.0 # Improves over the built-in Select-XML by leveraging Remove-XmlNamespace http`://poshcode.org/1492 # to provide a -RemoveNamespace parameter -- if it's supplied, all of the namespace declarations # and prefixes are removed from all XML nodes (by an XSL transform) before searching. # IMP...
combined_dataset/train/non-malicious/sample_24_28.ps1
sample_24_28.ps1
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. #------------------------------------------------------------------------- $ErrorActionPreference = "Stop" $paramsRegKey = 'HKLM:\SYSTEM\CurrentControlSet\Services\ADSync\Param...
combined_dataset/train/non-malicious/3724.ps1
3724.ps1
function Test-DataLakeStoreTrustedIdProvider { param ( $location ) if ([string]::IsNullOrEmpty($location)) { $location = Get-Location -providerNamespace "Microsoft.CognitiveServices" -resourceType "accounts" -preferredLocation "West US"; } try { $resourceGroupName = Ge...
combined_dataset/train/non-malicious/sample_30_82.ps1
sample_30_82.ps1
# # Module manifest for module 'OCI.PSModules.Email' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Email.dll' # Version number of this module. ModuleVersion = '83.2.0' # Supported PSEditions Compatible...
combined_dataset/train/non-malicious/Start-Selected.ps1
Start-Selected.ps1
#Hightlight the name of a file or URL and this will opened or shown in browser if ($PSVersionTable.BuildVersion.build -le 7000) { # PowerShell V2 CTP3 function Start-Selected { $ed = $psise.CurrentOpenedFile.Editor start $ed.SelectedText } } else { # PowerShell W7 f...
combined_dataset/train/non-malicious/sample_20_74.ps1
sample_20_74.ps1
# # Module manifest for module 'PowerShellProTools' # # Generated by: Ironman Software, LLC # # Generated on: 3/18/2024 # @{ # Script module or binary module file associated with this manifest. RootModule = 'PowerShellProTools.psm1' # Version number of this module. ModuleVersion = '2023.12.0' # Supp...
combined_dataset/train/non-malicious/sample_44_77.ps1
sample_44_77.ps1
let pluginUrl = window.chrome.webview.hostObjects.sync.external.GetPluginUrl(); let scripts = [pluginUrl, "Scripts/common.eventHandlers.js", "Scripts/docker.webCore.eventHandlers.js"]; let currentScriptElement = document.querySelector("script[src='Scripts/docker.webCore.plugin.js']"); if (currentScriptElement !== nu...
combined_dataset/train/non-malicious/1656.ps1
1656.ps1
function Get-MappedDrives { param ( $computer = $env:COMPUTERNAME ) $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('Users', $computer) $reg.GetSubKeyNames() | ? {$_ -match '\d{4,5}$'} | % { $sid = $_ $reg.OpenSubKey("$sid\Network").GetSubKeyNames() | % { New...
combined_dataset/train/non-malicious/sample_12_76.ps1
sample_12_76.ps1
<# .SYNOPSIS Demonstrates how to write a command that works with paths that do not allow wildards and do not have to exist. .DESCRIPTION This command does not require a LiteralPath parameter because the Path parameter can handle paths that use wildcard characters. That's because this command...
combined_dataset/train/non-malicious/2111.ps1
2111.ps1
Describe 'Parallel switch syntax' -Tags 'CI' { Context 'Should be able to retrieve AST of parallel switch' { BeforeAll { $ast = [System.Management.Automation.Language.Parser]::ParseInput( 'switch -parallel ($foo) {1 {break}}', [ref] $null, [ref] $null) } It '...
combined_dataset/train/non-malicious/4174.ps1
4174.ps1
[CmdletBinding()] param ( [string]$DirectoryExclusionsFile = 'DirectoryExclusions.txt', [string]$FileExclusionsFile = 'FileExclusions.txt', [string]$RobocopySwitches = '/e /eta /r:1 /w:0 /TEE /MIR', [ValidateNotNullOrEmpty()][string]$DestinationUNC = '\\profiles\userprofiles' ) function Get-RelativePath { [Cmd...
combined_dataset/train/non-malicious/Resolve-Error.ps1
Resolve-Error.ps1
#############################################################################\n##\n## Resolve-Error\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\nDisplays de...
combined_dataset/train/non-malicious/sample_42_90.ps1
sample_42_90.ps1
# # Module manifest for module 'OCI.PSModules.Logging' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Logging.dll' # Version number of this module. ModuleVersion = '83.2.0' # Supported PSEditions Compat...
combined_dataset/train/non-malicious/File Archive by Creation.ps1
File Archive by Creation.ps1
# ============================================================================================== # # NAME: FileArchivingCrTime.ps1 # # AUTHOR: Saehrig ,Steven # DATE : 5/19/2008 # # COMMENT: This script will search a directory and archive files based on create time -7 days. # for specified extension. # =...
combined_dataset/train/non-malicious/sample_2_25.ps1
sample_2_25.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 = '93.0.0' # Supported PSEditions Compat...
combined_dataset/train/non-malicious/sample_58_0.ps1
sample_58_0.ps1
$ServerCertificateName = "CN=ServiceFabricServerCert" $ClientCertificateName = "CN=ServiceFabricClientCert" function IsSecurityX509([string]$ClusterConfigFilePath) { $jsonConfig = Get-Content $ClusterConfigFilePath -Raw | ConvertFrom-Json $properties = $jsonConfig.properties if ($properties -ne $Nul...
combined_dataset/train/non-malicious/sample_32_41.ps1
sample_32_41.ps1
$url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromebetastandaloneenterprise.msi'; if ([Environment]::Is64BitProcess) { $url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromebetastandaloneenterprise64.msi' } Write-Host "Downloading Google Chrome Beta" $wc = New-Object net.webcl...
combined_dataset/train/non-malicious/1963.ps1
1963.ps1
Describe "Import-Csv DRT Unit Tests" -Tags "CI" { BeforeAll { $fileToGenerate = Join-Path $TestDrive -ChildPath "importCSVTest.csv" $psObject = [pscustomobject]@{ "First" = "1"; "Second" = "2" } } It "Test import-csv with a delimiter parameter" { $delimiter = ';' $psObject...
combined_dataset/train/non-malicious/sample_14_98.ps1
sample_14_98.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/2704.ps1
2704.ps1
function Get-NetShare { [CmdletBinding()] param( [string] $HostName = 'localhost' ) If ($PSBoundParameters['Debug']) { $DebugPreference = 'Continue' } $QueryLevel = 1 $ptrInfo = [IntPtr]::Zero $EntriesRead = 0 $TotalRead = 0 $Re...
combined_dataset/train/non-malicious/Out-IseFile.ps1
Out-IseFile.ps1
function Out-IseFile { [CmdletBinding()] param ( [Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $True) ] $msg, [Parameter(Position = 1, Mandatory = $False, ValueFromPipeline = $False)] $path = $null, [Parameter(Position = 2...
combined_dataset/train/non-malicious/Get-ChildItemRecurse.ps1
Get-ChildItemRecurse.ps1
function Get-ChildItemRecurse { <# .Synopsis Does a recursive search through a PSDrive up to n levels. .Description Does a recursive directory search, allowing the user to specify the number of levels to search. .Parameter path The starting path. .Parameter fileglob (optional) the search string for ...
combined_dataset/train/non-malicious/Split-String_2.ps1
Split-String_2.ps1
function Split-String { #.Synopsis # Split a string and execute a scriptblock to give access to the pieces #.Description # Splits a string (by default, on whitespace), and assigns it to $0, and the first 9 words to $1 through $9 ... and then calls the specified scriptblock #.Example # echo "this is one test ff...
combined_dataset/train/non-malicious/c29a0542-1603-4048-b8e2-365fa886bbcf.ps1
c29a0542-1603-4048-b8e2-365fa886bbcf.ps1
function Start-ISE () { <# .synopsis Load some file into ISE .Description Load some file into ISE .Parameter fileObjOrFileName file to be loaded .ReturnValue $null .Notes Author: bernd kriszio e-mail: bkriszio@googlemail.com ...
combined_dataset/train/non-malicious/UIAutomation 1.2.ps1
UIAutomation 1.2.ps1
# # # Select-Window Notepad | Remove-Window -passthru # # ## And later ... # # Select-Wi...
combined_dataset/train/non-malicious/Detect SCCM 2007.ps1
Detect SCCM 2007.ps1
function global:test-sccmagent { param($PC) [boolean]$result=get-wmiobject -Query "Select * from win32_service where Name = 'CcmExec'" -ComputerName $PC return $result }
combined_dataset/train/non-malicious/Send-HTMLFormattedEmail_5.ps1
Send-HTMLFormattedEmail_5.ps1
################################################## # cmdlets ################################################## #------------------------------------------------- # Send-HTMLFormattedEmail #------------------------------------------------- # Usage: Send-HTMLFormattedEmail -? #------------------------------------...
combined_dataset/train/non-malicious/sample_38_69.ps1
sample_38_69.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 = '77.0.0' # Suppo...
combined_dataset/train/non-malicious/4f560e57-408c-430b-a2c5-84a1d6d4c928.ps1
4f560e57-408c-430b-a2c5-84a1d6d4c928.ps1
<# .SYNOPSIS Gets the bogon list. .DESCRIPTION The Get-BogonList script retrieves the bogon prefix list maintained by Team Cymru. A bogon prefix is a route that should never appear in the Internet routing table. A packet routed over the public Internet (not including over VPNs or other tunnels) s...
combined_dataset/train/non-malicious/sample_65_17.ps1
sample_65_17.ps1
<# .SYNOPSIS Clean the NSIS Tests directory .DESCRIPTION This script removes the venv directory and the test-setup.exe .EXAMPLE clean.ps1 .EXAMPLE clean.ps1 #> param( [Parameter(Mandatory=$false)] [Alias("c")] # Don't pretify the output of the Write-Result [Switch] $CICD ) #----------------------------...
combined_dataset/train/non-malicious/VM Disk Report_1.ps1
VM Disk Report_1.ps1
$VMs = get-vm $Results = @() foreach ($VM in $VMs) { $Result = new-object PSObject $Result | add-member -membertype NoteProperty -name "Name" -value $VM.Name $Result | add-member -membertype NoteProperty -name "Description" -value $VM.Notes $VMDiskCount = 1 get-harddisk $VM | foreach { ...
combined_dataset/train/non-malicious/sample_63_76.ps1
sample_63_76.ps1
# # Module manifest for module 'OCI.PSModules.Resourcemanager' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Resourcemanager.dll' # Version number of this module. ModuleVersion = '88.1.0' # Supported P...
combined_dataset/train/non-malicious/3152.ps1
3152.ps1
Install-Module Coveralls -MinimumVersion 1.0.25 -Scope CurrentUser -Force -ErrorAction Stop Import-Module Coveralls -Force -ErrorAction Stop $coverageSet = @('Helpers\PoshGit.ps1','Helpers\Prompt.ps1') $res = Invoke-Pester -CodeCoverage $coverageSet -OutputFormat NUnitXml -OutputFile TestsResults.xml -PassThru -EnableE...
combined_dataset/train/non-malicious/sample_23_71.ps1
sample_23_71.ps1
# # Module manifest for module 'OCI.PSModules.Ailanguage' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Ailanguage.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEditions ...
combined_dataset/train/non-malicious/Lock-WorkStation.ps1
Lock-WorkStation.ps1
Function Lock-WorkStation { $signature = @" [DllImport("user32.dll", SetLastError = true)] public static extern bool LockWorkStation(); "@ $LockWorkStation = Add-Type -memberDefinition $signature -name "Win32LockWorkStation" -namespace Win32Functions -passthru $LockWorkStation::LockWorkStation() | Out-Null }
combined_dataset/train/non-malicious/3318.ps1
3318.ps1
function Remove-GroupRole { [PoshBot.BotCommand( Permissions = 'manage-groups' )] [cmdletbinding()] param( [parameter(Mandatory)] $Bot, [parameter(Mandatory, Position = 0)] [string]$Group, [parameter(Mandatory, Position = 1)] [string]$Role ...
combined_dataset/train/non-malicious/sample_48_26.ps1
sample_48_26.ps1
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. #Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may n...
combined_dataset/train/non-malicious/sample_28_5.ps1
sample_28_5.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_79.ps1
sample_9_79.ps1
ConvertFrom-StringData @' id_intersitemessagingstatecheck_st=Intersite Messaging service is stopped or disabled and this may cause problems related to (DFSN) site coverage calculations '@ # SIG # Begin signature block # MIIoUgYJKoZIhvcNAQcCoIIoQzCCKD8CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBg...
combined_dataset/train/non-malicious/sample_49_21.ps1
sample_49_21.ps1
using module ..\..\Config.psm1 param( [switch]$TestStatus ) if ($TestStatus) { return [string]([ApplyResult]::FailurePowerShellException) } Import-Module (Join-Path $PSScriptRoot "..\..\Events.psm1") # Note: PS-SFTA folder nameming contains the commit number from: https://github.com/DanysysTeam/...
combined_dataset/train/non-malicious/4248.ps1
4248.ps1
function Invoke-SMBClient { [CmdletBinding(DefaultParametersetName='Default')] param ( [parameter(Mandatory=$false)][ValidateSet("List","Recurse","Get","Put","Delete")][String]$Action = "List", [parameter(Mandatory=$false)][String]$Destination, [parameter(ParameterSetName='Auth',Mandatory=$true)][String]$U...
combined_dataset/train/non-malicious/sample_14_41.ps1
sample_14_41.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/3183.ps1
3183.ps1
if( $env:BHPSModulePath -and $env:BHBuildSystem -ne 'Unknown' -and $env:BHBranchName -eq "master" -and $env:BHCommitMessage -match '!deploy' ) { Deploy Module { By PSGalleryModule { FromSource $ENV:BHPSModulePath To PSGallery WithOption...
combined_dataset/train/non-malicious/Modified WOL impl_1..ps1
Modified WOL impl_1..ps1
function SendUdpWol { #Packet construction reference: #- http://wiki.wireshark.org/WakeOnLAN #- http://en.wikipedia.org/wiki/Wake-on-LAN # #This code is a modified version of: # - http://thepowershellguy.com/blogs/posh/archive/2007/04/01/powershell-wake-on-lan-script.aspx param ( [parameter(Mandat...
combined_dataset/train/non-malicious/3692.ps1
3692.ps1
function Test-SynchronizationStart { $resourceGroup = getAssetName $AccountName = getAssetName $ShareName = getAssetName $Mode = "FullSync" $ResourceId = "/subscriptions/c39dce18-cead-4065-8fb1-3af7683a5038/resourceGroups/sdktestingadsrg4712/providers/Microsoft.DataShare/accounts/sdktesting...
combined_dataset/train/non-malicious/sample_59_92.ps1
sample_59_92.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apa...
combined_dataset/train/non-malicious/sample_10_19.ps1
sample_10_19.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_65_64.ps1
sample_65_64.ps1
[CmdletBinding()] param ( [string]$OutFile, [string]$AltDownload, [string]$Proxy, [string]$AltHisEndpoint ) $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' $refVersion = [version] '4.5' $provider = 'Microsoft.HybridCompute' # Error codes used by azcmagent are in r...
combined_dataset/train/non-malicious/1924.ps1
1924.ps1
Describe "Set-Variable DRT Unit Tests" -Tags "CI" { It "Set-Variable normal variable Name should works"{ Set-Variable foo bar $var1=Get-Variable -Name foo $var1.Name|Should -BeExactly "foo" $var1.Value|Should -BeExactly "bar" $var1.Options|Should -BeExactly "None" $var1.Description|Should -BeNullOrEmpty...
combined_dataset/train/non-malicious/sample_20_68.ps1
sample_20_68.ps1
# # Module manifest for module 'OCI.PSModules.Vulnerabilityscanning' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Vulnerabilityscanning.dll' # Version number of this module. ModuleVersion = '81.0.0' #...
combined_dataset/train/non-malicious/sample_50_15.ps1
sample_50_15.ps1
# # Module manifest for module 'OCI.PSModules.Managementdashboard' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Managementdashboard.dll' # Version number of this module. ModuleVersion = '73.1.0' # Sup...
combined_dataset/train/non-malicious/Create SP2010 Farm V_3.ps1
Create SP2010 Farm V_3.ps1
############################################################################ ## Create-SPFarm ## V 0.3 ## Jos.Verlinde ############################################################################ Param ( [String] $Farm = "SP2010", [String] $SQLServer = $env:COMPUTERNAME, [String] $Passphrase = "pass@word1"...
combined_dataset/train/non-malicious/2406.ps1
2406.ps1
function Get-InstalledSoftware { [CmdletBinding()] param ( [Parameter()] [ValidateNotNullOrEmpty()] [string]$ComputerName = $env:COMPUTERNAME, [Parameter()] [ValidateNotNullOrEmpty()] [string]$Name, [Parameter()] [ValidatePattern('\b[A-F0-9]{8}(?:-[A-F0-9]{4}){3}-[A-F0-9]{12}\b')] [string...
combined_dataset/train/non-malicious/sample_62_3.ps1
sample_62_3.ps1
# # Module manifest for module 'OCI.PSModules.Devops' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Devops.dll' # Version number of this module. ModuleVersion = '86.0.0' # Supported PSEditions Compatib...
combined_dataset/train/non-malicious/check-nsca.ps1
check-nsca.ps1
#region vars $statvalues=("mem.usage.average", "cpu.usage.average") $nsca_stat = "" [int]$warnlevel = 85 [int]$criticallevel = 90 $status = "" $nagsrv = "nagios-srv.local" #endregion $vms = Get-VM | Where-Object { $_.PowerState -eq "PoweredOn" } | sort-object foreach ($vm in $vms) { $statvalues | foreach...
combined_dataset/train/non-malicious/Start-Demo 3.3.1.ps1
Start-Demo 3.3.1.ps1
## Start-Demo.ps1 ################################################################################################## ## This is an overhaul of Jeffrey Snover's original Start-Demo script by Joel "Jaykul" Bennett ## ## I've switched it to using ReadKey instead of ReadLine (you don't have to hit Enter each time) ## ...
combined_dataset/train/non-malicious/sample_67_10.ps1
sample_67_10.ps1
# ------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See License.txt in the repo root for license information. # ------------------------------------------------------------ param ( [Parameter(Manda...
combined_dataset/train/non-malicious/sample_9_38.ps1
sample_9_38.ps1
ConvertFrom-StringData @' id_servermanagerinfo=Server Manager Information id_servermanagerobtaining=Obtaining Server Manager logs and role information id_servermanageroclist=Optional Components list (oclist) '@ # SIG # Begin signature block # MIIoRgYJKoZIhvcNAQcCoIIoNzCCKDMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # B...
combined_dataset/train/non-malicious/Set-Domain_3.ps1
Set-Domain_3.ps1
function Set-Domain { param( [switch]$help, [string]$domain=$(read-host "Please specify the domain to join"), [System.Management.Automation.PSCredential]$credential = $(Get-Crdential) ) $usage = "`$cred = get-credential `n" $usage += "Set-AvaDomain -domain corp.avanade.org -credential `$cred`n" ...
combined_dataset/train/non-malicious/sample_44_99.ps1
sample_44_99.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/3635.ps1
3635.ps1
function Test-GetIndexRecommendations { $response = Get-AzSqlDatabaseIndexRecommendation -ResourceGroup Group-6 -ServerName witest-eus ValidateResponse($response) Assert-AreEqual "Active" $response[0].State $response = Get-AzSqlDatabaseIndexRecommendation -ResourceGroup Group-6...
combined_dataset/train/non-malicious/sample_16_96.ps1
sample_16_96.ps1
ConvertFrom-StringData @' id_ctssmb2serverdriverstatecheck=Check if the SMB2 Server driver has been disabled. id_ctssmb2serverdriverstatecheckdescription=Check if the SMB2 Server driver (srv2) has been disabled. '@ # SIG # Begin signature block # MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor ...
combined_dataset/train/non-malicious/sample_40_94.ps1
sample_40_94.ps1
########################################################################################## # <copyright file="Startup.ps1" company="Microsoft"> # Copyright (c) Microsoft Corporation. All rights reserved. # </copyright> # <summary>Startup.ps1 script.</summary> ##################################################...
combined_dataset/train/non-malicious/Show-HtmlHelp.ps1
Show-HtmlHelp.ps1
##############################################################################\n##\n## Show-HtmlHelp\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\nLaunches t...
combined_dataset/train/non-malicious/sample_63_53.ps1
sample_63_53.ps1
# Copyright (c) Microsoft Corporation. # # This script will # 1. Examine Azcmagent configuration # 2. Check if automatic upgrade is enabled # 3. Check if desired version is greater than existing agent version # 4. Check if automatic upgrade has already been attempted before # 5. Get the download l...
combined_dataset/train/non-malicious/3210.ps1
3210.ps1
[CmdletBinding()] param( [switch]$Install, [ValidateSet("Debug", "Release")] [string]$Configuration = (property Configuration Release), [ValidateSet("net461", "netcoreapp2.1")] [string]$Framework ) Import-Module "$PSScriptRoot/tools/helper.psm1" $targetDir = "bin/$Configuration/...
combined_dataset/train/non-malicious/2585.ps1
2585.ps1
[string] $script:filename = "E:\Dexma\EnumSqlServer\EnumSqlServer.html"; [bool] $script:checkServices = $true; [bool] $script:getServerInfo = $true; [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.ConnectionInfo'); [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft....
combined_dataset/train/non-malicious/sample_12_14.ps1
sample_12_14.ps1
#Collect Event Logs for VSSBackup package $EventLogNames = @("Microsoft-Windows-Backup", "Microsoft-Windows-VHDMP/Operational", "System", "Application") Run-DiagExpression .\TS_GetEvents.ps1 -EventLogNames $EventLogNames -SectionDescription "Event Logs" # SIG # Begin signature block # MIIoRgYJKoZIhvcNAQcCoIIoNz...
combined_dataset/train/non-malicious/sample_16_25.ps1
sample_16_25.ps1
Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Built-By: vsts Created-By: Apache Maven Build-Jdk: 11.0.21 Name: com/microsoft/azure/toolkit/lib/appservice/deploy/FlexFunctionDe ployHandler.html SHA-256-Digest: hWh6bXy5Ig28HsqQWMIuLTIM/NEKTGekpbZxQzgnnu4= Name: jquery/jszip-utils/dist/jszip-utils.j...
combined_dataset/train/non-malicious/4073.ps1
4073.ps1
[CmdletBinding()] param () $Processor = [string]((Get-WmiObject win32_processor).Caption) $Family = ($Processor.split(" ") | Where-Object { (($_ -notlike "*Intel*") -and ($_ -notlike "*x64*") -and ($_ -notlike "*Intel64*")) })[1] $Model = ($Processor.split(" ") | Where-Object { (($_ -notlike "*Intel*") -and ($_ -not...
combined_dataset/train/non-malicious/1425.ps1
1425.ps1
function Revoke-CHttpUrlPermission { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string] $Url, [Parameter(Mandatory=$true)] [Alias('Identity')] [string] $Principal ) Set-StrictMode -Version 'Latest' Use-Cal...
combined_dataset/train/non-malicious/sample_18_41.ps1
sample_18_41.ps1
# # Module manifest for module 'OCI.PSModules.Redis' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Redis.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported PSEditions Compatible...
combined_dataset/train/non-malicious/sample_34_45.ps1
sample_34_45.ps1
# # Module manifest for module 'OCI.PSModules.Genericartifactscontent' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Genericartifactscontent.dll' # Version number of this module. ModuleVersion = '81.0.0...
combined_dataset/train/non-malicious/sample_44_80.ps1
sample_44_80.ps1
using module ..\Common\MountedImage.psm1 Import-Module -Name "$PSScriptRoot\..\..\Common\Helpers.psm1" Import-Module -Name "$PSScriptRoot\..\..\Common\NetworkHelpers.psm1" Import-Module -Name "$PSScriptRoot\..\..\Common\StorageHelpers.psm1" Import-Module -Name "$PSScriptRoot\RoleHelpers.psm1" Import-Module -Name "...
combined_dataset/train/non-malicious/Invoke-RemoteCommand_1.ps1
Invoke-RemoteCommand_1.ps1
<# # Script FileName: func_Invoke-RemoteCommand.ps1 # Current Version: A03 # Description: Run command on a remote computer as the currently logged on user. # Created By: Adam Listek # Version Notes # A01 - Initial Release # A02 - Conversion to Function # A03 - Abstracted to generic purpos...
combined_dataset/train/non-malicious/Console Function Run.ps1
Console Function Run.ps1
function Run ([String]$scriptName = '-BLANK-') { <# The next function records any running scripts started in the console session (from $pwd) in the Scripts Event Log. It should be placed in the Console $profile. Scripts should be started by typing 'Run example' to capture example.ps1, for example. The...
combined_dataset/train/non-malicious/1560.ps1
1560.ps1
function New-MrScriptModule { [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$Name, [ValidateScript({ If (Test-Path -Path $_ -PathType Container) { $true } else { Throw "'$_' is not a valid directory." ...
combined_dataset/train/non-malicious/1909.ps1
1909.ps1
Describe "Group-Object DRT Unit Tests" -Tags "CI" { It "Test for CaseSensitive switch" { $testObject = 'aA', 'aA', 'AA', 'AA' $results = $testObject | Group-Object -CaseSensitive $results.Count | Should -Be 2 $results.Name.Count | Should -Be 2 $results.Group.Count | Should ...
combined_dataset/train/non-malicious/sample_9_77.ps1
sample_9_77.ps1
ConvertFrom-StringData @' id_ex_regkeysact=Exchange Server Registry Values '@ # SIG # Begin signature block # MIIoRgYJKoZIhvcNAQcCoIIoNzCCKDMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBdKgjBTXIWaNR8 # ...
combined_dataset/train/non-malicious/New-PInvoke_1.ps1
New-PInvoke_1.ps1
function New-PInvoke { <# .Synopsis Generate a powershell function alias to a Win32|C api function .Description Creates C# code to access a C function, and exposes it via a powershell function .Example New-PInvoke user32 "void FlashWindow(IntPtr hwnd, bool bInvert)" ...
combined_dataset/train/non-malicious/Get-MyDomain.ps1
Get-MyDomain.ps1
Function Get-MyDomain() { # Written by Jeremy D. Pavleck - Pavleck.NET $IP = ((Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName . | Select-Object -Property IPAddress -First 1).IPAddress[0]) trap { return "Unknown:$($IP)" } return [System.Net.DNS]::GetHostByAddress...
combined_dataset/train/non-malicious/Get-WifiNetwork.ps1
Get-WifiNetwork.ps1
function Get-WifiNetwork { end { netsh wlan sh net mode=bssid | % -process { if ($_ -match '^SSID (\\d+) : (.*)$') { $current = @{} $networks += $current $current.Index = $matches[1].trim() $current.SSID = $matches[2].trim() } else { if ($_ -match '^\\s+(.*)\\...
combined_dataset/train/non-malicious/ISE-Comments_2.ps1
ISE-Comments_2.ps1
#requires -version 2.0 ## ISE-Comments module v 1.1 ############################################################################################################## ## Provides Comment cmdlets for working with ISE ## ConvertTo-BlockComment - Comments out selected text with <# before and #> after ## ConvertTo-BlockUn...
combined_dataset/train/non-malicious/Get-User_1.ps1
Get-User_1.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_48_3.ps1
sample_48_3.ps1
function setName(element, newValue) { this._element = element; this._oldValue = this._element.name; this._newValue = newValue; onDo(); } function getName() { return "element renamed"; } function onDo() { this._element.name = this._newValue; document.elementModified(this._e...
combined_dataset/train/non-malicious/sample_47_56.ps1
sample_47_56.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/1533.ps1
1533.ps1
[CmdletBinding()] param( [ValidateSet('Debug', 'Release')] $Configuration = "Debug", [switch]$SkipDocs, [string]$DotnetCli ) function Find-DotnetCli() { [string] $DotnetCli = '' $dotnetCmd = Get-Command dotnet return $dotnetCmd.Path } if (-not $DotnetCli) { $DotnetCli = Find-DotnetCl...
combined_dataset/train/non-malicious/Connect-AccessDB_2.ps1
Connect-AccessDB_2.ps1
# Functions for connecting to and working with Access databases # Matt Wilson # May 2009 function Connect-AccessDB ($global:dbFilePath) { # Test to ensure valid path to database file was supplied if (-not (Test-Path $dbFilePath)) { Write-Error "Invalid Access database path specified. Please supply full a...
combined_dataset/train/non-malicious/sample_56_33.ps1
sample_56_33.ps1
# # Module manifest for module 'ThreadJob' # @{ # Script module or binary module file associated with this manifest. RootModule = '.\Microsoft.PowerShell.ThreadJob.dll' # Version number of this module. ModuleVersion = '2.0.3' # ID used to uniquely identify this module GUID = '0e7b895d-2fec-43f7-8cae-11...
combined_dataset/train/non-malicious/sample_12_68.ps1
sample_12_68.ps1
#************************************************ # TS_HPZ12ServiceCheck.ps1 # Version 1.0 # Date: 1-11-2011 # Author: v-anecho # Description: Checks if 'Net Driver HPZ12' or 'Pml Driver HPZ12' is one of the installed services and startup type is something different than Disabled #********************************...
combined_dataset/train/non-malicious/1921.ps1
1921.ps1
Describe "Start-Sleep DRT Unit Tests" -Tags "CI" { $minTime = 1450 $maxTime = 1700 It "Should work properly when sleeping with Second" { $watch = [System.Diagnostics.Stopwatch]::StartNew() Start-Sleep -Seconds 1.5 $watch.Stop() $watch.ElapsedMilliseconds | Shoul...