full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/sample_25_16.ps1
sample_25_16.ps1
# region Generated # Load the private module dll $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.ApplicationInsights.private.dll') # Load the internal module $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.ApplicationInsights.internal.psm1' if(Test-Path $interna...
combined_dataset/train/non-malicious/sample_50_29.ps1
sample_50_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\jiti@1.21.0\node_modules\jiti\bin\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\jiti@1.21.0\no...
combined_dataset/train/non-malicious/566.ps1
566.ps1
function Find-SPOFieldName { [CmdletBinding()] param ( [Parameter(Mandatory=$true, Position=1)] [string] $listTitle, [Parameter(Mandatory=$true, Position=2)] [string] $displayName ) $web = $clientContext.Web $list = $web.Lists.GetByTitle($listTitle) $fields = $list.Fields $clientConte...
combined_dataset/train/non-malicious/Search cmdlet help.ps1
Search cmdlet help.ps1
function Search-Help($term) { Get-Command | Where { Get-Help -full -ea SilentlyContinue $_ | Out-String | Select-String $term } }
combined_dataset/train/non-malicious/3890.ps1
3890.ps1
function Test-AzureRmSignalR { $resourceGroupName = Get-RandomResourceGroupName $signalrName = Get-RandomSignalRName $freeSignalRName = Get-RandomSignalRName "signalr-free-test-" $location = Get-ProviderLocation "Microsoft.SignalRService/SignalR" try { New-AzResourceGrou...
combined_dataset/train/non-malicious/2816.ps1
2816.ps1
$data = $null foreach ($file in (ls *svcall.xml)) { $data += Import-Clixml $file } $data | ? { $_.StartMode -eq "Auto" -or $_.State -eq "Running" }
combined_dataset/train/non-malicious/3494.ps1
3494.ps1
function Test-DefaultResourceGroup { $rgname = Get-ResourceGroupName Clear-AzDefault -ResourceGroup try { $output = Get-AzDefault Assert-Null($output) $output = Get-AzDefault -ResourceGroup Assert-Null($output) $storedValue = (Get-AzContext).ExtendedProperties["Default Resource Group"...
combined_dataset/train/non-malicious/OpsMgr.psd1.ps1
OpsMgr.psd1.ps1
<# #Run the following code to create OpsMgr module #To Use run import-module OpsMgr; Start-OperationsManagerClientShell -ManagementServerName: "" -PersistConnection: $true -Interactive: $true; if (-not (test-path $home\\Documents\\WindowsPowerShell\\Modules\\OpsMgr)) {new-item $home\\Documents\\WindowsPowerShell\...
combined_dataset/train/non-malicious/sample_39_95.ps1
sample_39_95.ps1
<# .SYNOPSIS This script builds the MSI installer .DESCRIPTION This script builds the MSI installer from the contents of the buildenv directory .EXAMPLE build_pkg.ps1 .EXAMPLE build_pkg.ps1 -Version 3005 #> param( [Parameter(Mandatory=$false)] [Alias("v")] # The version of Salt to be built. If this is n...
combined_dataset/train/non-malicious/sample_45_85.ps1
sample_45_85.ps1
# # Module manifest for module 'OCI.PSModules.Jms' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Jms.dll' # Version number of this module. ModuleVersion = '80.0.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/Delete AD Users.ps1
Delete AD Users.ps1
function Delete-ADUser { Param($userName = $(throw 'Enter a username to delete')) $searcher = New-Object System.DirectoryServices.DirectorySearcher([ADSI]"","(&(objectcategory=user)(sAMAccountName=$userName))") $user = $searcher.findone().GetDirectoryEntry() $user.psbase.DeleteTree() } $NumDays = 90 $Lo...
combined_dataset/train/non-malicious/PowerShell CMatrix.ps1
PowerShell CMatrix.ps1
Set-StrictMode -off # # Module: PowerShell Console ScreenSaver Version 0.1 # Author: Oisin Grehan ( http://www.nivot.org ) # # A PowerShell CMatrix-style screen saver for true-console hosts. # # This will not work in Micrisoft's ISE, Quest's PowerGUI or other graphical hosts. # It should work fine in PowerShe...
combined_dataset/train/non-malicious/268.ps1
268.ps1
function Set-SCCMClientCacheLocation { PARAM( [string[]]$ComputerName=".", [parameter(Mandatory)] [int]$Location, [Switch]$ServiceRestart, [Alias('RunAs')] [System.Management.Automation.Credential()] $Credential = [System.Management.Automation.PSCreden...
combined_dataset/train/non-malicious/1100.ps1
1100.ps1
$siteName = 'CarbonGetIisHttpHeader' $sitePort = 47939 function Start-TestFixture { & (Join-Path -Path $PSScriptRoot '..\Initialize-CarbonTest.ps1' -Resolve) } function Start-Test { Install-IisWebsite -Name $siteName -Path $TestDir -Binding ('http/*:{0}:*' -f $sitePort) } function Stop-Test { ...
combined_dataset/train/non-malicious/sample_48_0.ps1
sample_48_0.ps1
# region Generated # Load the private module dll $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.ManagedServiceIdentity.private.dll') # Load the internal module $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.ManagedServiceIdentity.internal.psm1' if(Test-Path $i...
combined_dataset/train/non-malicious/sample_29_98.ps1
sample_29_98.ps1
# # Module manifest for module 'OCI.PSModules.Oda' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Oda.dll' # Version number of this module. ModuleVersion = '75.1.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/1342.ps1
1342.ps1
function Assert-CAdminPrivilege { [CmdletBinding()] param( ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState if( -not (Test-CAdminPrivilege) ) { Write-Error "You are not currently running with administrative...
combined_dataset/train/non-malicious/where-property_1.ps1
where-property_1.ps1
function where-property([string] $PropertyName,[string]$SubProperty , $is,$isnot,$contains,$in,$SelectProperty) { process { $useprop = $SelectProperty Function _outobj { if ($useprop ) { , $_.$useprop } else { , $_ } } if ($is) ...
combined_dataset/train/non-malicious/sample_29_66.ps1
sample_29_66.ps1
# # Copyright (c) Microsoft Corporation. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE ...
combined_dataset/train/non-malicious/sample_61_1.ps1
sample_61_1.ps1
# # This script handles common telemetry tasks for Install.ps1 and Add-AppDevPackage.ps1. # function IsVsTelemetryRegOptOutSet() { $VsTelemetryRegOptOutKeys = @( "HKLM:\SOFTWARE\Policies\Microsoft\VisualStudio\SQM", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\VSCommon\16.0\SQM", "HKLM:\S...
combined_dataset/train/non-malicious/sample_21_41.ps1
sample_21_41.ps1
# # Module manifest for module 'OCI.PSModules.Ospgateway' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Ospgateway.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported PSEditions ...
combined_dataset/train/non-malicious/sample_25_59.ps1
sample_25_59.ps1
<# .SYNOPSIS Sets registration token cache in ECE secret store for Azure stack deployment. .DESCRIPTION This script sets registration token cache in ECE secret store for Azure stack deployment. .PARAMETER RegistrationUserTokenCache The Azure account user token cache. This parameter must be passed in...
combined_dataset/train/non-malicious/sample_4_22.ps1
sample_4_22.ps1
#************************************************ # TS_SurfaceDetectFirmwareVersions.ps1 # Description: SurfaceDetectFirmwareVersions # # Rule GUID: 34F6567E-7B92-4C37-B1CA-5DE6E66D4881 # # Files: # TS_SurfaceDetectFirmwareVersions.ps1 # RC_SurfaceDetectFirmwareVersions.xml # Include.xml # # Output files: #...
combined_dataset/train/non-malicious/4265.ps1
4265.ps1
function Invoke-SMBExec { [CmdletBinding()] param ( [parameter(Mandatory=$true)][String]$Target, [parameter(Mandatory=$true)][String]$Username, [parameter(Mandatory=$false)][String]$Domain, [parameter(Mandatory=$false)][String]$Command, [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$Co...
combined_dataset/train/non-malicious/sample_8_55.ps1
sample_8_55.ps1
ConvertFrom-StringData @' id_servicingpendingxml_st=Pending.xml file detected on WinSxS folder '@ # SIG # Begin signature block # MIIoLAYJKoZIhvcNAQcCoIIoHTCCKBkCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUA...
combined_dataset/train/non-malicious/sample_21_15.ps1
sample_21_15.ps1
#************************************************ # DC_DPMEventLogs.ps1 # Version 1.0.1 # Date: 06-29-2011 # Author: Patrick Lewis - patlewis@microsoft.com # Description: This script get DPM related event logs #************************************************ if($debug -eq $true){[void]$shell.popup("Run DC_DPMEv...
combined_dataset/train/non-malicious/2828.ps1
2828.ps1
$projectRoot = "$PSScriptRoot/.." $moduleName = 'psake' $manifestPath = "$PSScriptRoot/../src/psake.psd1" $manifest = Import-PowerShellDataFile -Path $manifestPath $changelogPath = Join-Path -Path $projectRoot -Child 'CHANGELOG.md' Describe 'Module manifest' { Context 'Validation' { $script:manifest = $...
combined_dataset/train/non-malicious/sample_0_56.ps1
sample_0_56.ps1
param( [string]$DataPath, [switch]$AcceptEula ) $version = "Evt-Collect (20240604)" # by Gianni Bragante - gbrag@microsoft.com Function EvtLogDetails { param( [string] $LogName ) Write-Log ("Collecting the details for the " + $LogName + " log") $cmd = "wevtutil gl """ + $logname + """ >>""" + $g...
combined_dataset/train/non-malicious/768.ps1
768.ps1
param([string]$EditorServicesRepoPath = "") $ErrorActionPreference = "Stop" if (!(Test-Path "package.json")) { throw "This script must be run from the root vscode-powershell folder (contains package.json)." } if ([string]::IsNullOrEmpty($EditorServicesRepoPath) -or !(Test-Path $EditorServicesRepoPath)) { throw "...
combined_dataset/train/non-malicious/sample_10_91.ps1
sample_10_91.ps1
# # Module manifest for module 'OCI.PSModules.Recovery' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Recovery.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEditions Comp...
combined_dataset/train/non-malicious/Trim Working Set for PID_1.ps1
Trim Working Set for PID_1.ps1
## Trim Working set Function TrimWorkingSet { param([int] $procid) <#.NOTES AUTHOR: Sunny Chakraborty(sunnyc7@gmail.com) WEBSITE: http://tekout.wordpress.com CREATED: 9/20/2012 This starts the Evil Monkey series of scripts. .DESCRIPTION MSDN - http://msdn.microsoft.com/en-us/library/windows/desktop/ms6862...
combined_dataset/train/non-malicious/sample_21_79.ps1
sample_21_79.ps1
# # Module manifest for module 'OCI.PSModules.Databasemanagement' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Databasemanagement.dll' # Version number of this module. ModuleVersion = '75.1.0' # Suppo...
combined_dataset/train/non-malicious/sample_31_34.ps1
sample_31_34.ps1
# # Module manifest for module 'Az.StreamAnalytics' # # Generated by: Microsoft Corporation # # Generated on: 23/04/2024 # @{ # Script module or binary module file associated with this manifest. RootModule = 'Az.StreamAnalytics.psm1' # Version number of this module. ModuleVersion = '2.0.1' # Support...
combined_dataset/train/non-malicious/sample_45_14.ps1
sample_45_14.ps1
<# .SYNOPSIS Adds flow for a .NET preview or RC .PARAMETER RuntimeChannel Public runtime channel .PARAMETER SdkChannel Public sdk channel .PARAMETER RuntimeBranch Public runtime repo branch (e.g. release/8.0-preview2) .PARAMETER SdkBranch Public sdk repo branch (e.g. release/8.0.1xx-preview2) .PARAMETER VSChannel...
combined_dataset/train/non-malicious/sample_56_7.ps1
sample_56_7.ps1
# Welcome to Teams Toolkit! ## Quick Start > **Prerequisites** > > To run this app template in your local dev machine, you will need: > > - [Visual Studio 2022](https://aka.ms/vs) 17.9 or higher and [install Teams Toolkit](https://aka.ms/install-teams-toolkit-vs) > - A [Microsoft 365 account for development](https://...
combined_dataset/train/non-malicious/sample_16_10.ps1
sample_16_10.ps1
<############################################################## # # # Copyright (C) Microsoft Corporation. All rights reserved. # # # ##############################################################>...
combined_dataset/train/non-malicious/500.ps1
500.ps1
function Install-PPApp{ param( [Parameter(Mandatory=$false)] [String[]] $Name, [switch] $Force, [switch] $IgnoreDependencies, [switch] $Uninstall ) $CurrentLocation = (Get-Location).Path $AppD...
combined_dataset/train/non-malicious/939.ps1
939.ps1
$apiVersion = "2015-04-08" $resourceGroupName = "myResourceGroup" $accountName = "mycosmosaccount" $databaseName = "database1" $graphName = "graph1" $accountResourceName = $accountName + "/gremlin/" $databaseResourceName = $accountName + "/gremlin/" + $databaseName $databaseResourceType = "Microsoft.DocumentDb/databa...
combined_dataset/train/non-malicious/4306.ps1
4306.ps1
function SuiteSetup { Import-Module "$PSScriptRoot\PSGetTestUtils.psm1" -WarningAction SilentlyContinue Import-Module "$PSScriptRoot\Asserts.psm1" -WarningAction SilentlyContinue $script:MyDocumentsModulesPath = Get-CurrentUserModulesPath $script:PSGetLocalAppDataPath = Get-PSGetLocalAppDataPath ...
combined_dataset/train/non-malicious/sample_57_44.ps1
sample_57_44.ps1
#This script converts securestring to plaintext param( [Parameter(Mandatory, ValueFromPipeline)] [System.Security.SecureString] ${SecureString} ) $ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) try { $plaintext = [System.Runtime.InteropServices.Marshal]::...
combined_dataset/train/non-malicious/sample_48_23.ps1
sample_48_23.ps1
# PropertyReflection # ОтражениеСвойства Описание свойства объекта встроенного языка ## Name: BilingualString ## Имя: ДвуязычнаяСтрока Имя свойства на двух языках ## Types: ReadableSet<Type> ## Типы: ЧитаемоеМножество<Тип> Набор типов данных свойства ## Annotations: ReadableSet<Annotation> ## Аннотации: ЧитаемоеМ...
combined_dataset/train/non-malicious/sample_30_46.ps1
sample_30_46.ps1
Add-AppxPackage exit cd C:\Users\sampler-win_10_x64\Desktop\ Get-AppxPackage >apps.tx cd C:\Users\sampler-win_10_x64\Desktop\ Get-AppxPackage -allusers | Select Name, PackageFullName > apps_v2.txt Get-AppxPackage | Select Name, PackageFullName > apps_v2.txt Get-AppxPackage Get-AppxPackage -Online Get-AppxPacka...
combined_dataset/train/non-malicious/sample_57_19.ps1
sample_57_19.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_49_53.ps1
sample_49_53.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/1448.ps1
1448.ps1
function Install-CIisAppPool { [CmdletBinding(DefaultParameterSetName='AsServiceAccount')] [OutputType([Microsoft.Web.Administration.ApplicationPool])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams","")] param( [Parameter(Mandatory=$true)] ...
combined_dataset/train/non-malicious/2098.ps1
2098.ps1
Describe "Dynamic parameter support in script cmdlets." -Tags "CI" { BeforeAll { Class MyTestParameter { [parameter(ParameterSetName = 'pset1', position=0, mandatory=1)] [string] $name } function foo-bar { [CmdletBinding()] param($pa...
combined_dataset/train/non-malicious/sample_62_34.ps1
sample_62_34.ps1
# # Module manifest for module 'OCI.PSModules.Demandsignal' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Demandsignal.dll' # Version number of this module. ModuleVersion = '86.0.0' # Supported PSEditi...
combined_dataset/train/non-malicious/sample_57_16.ps1
sample_57_16.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 = '86.2.0' # Sup...
combined_dataset/train/non-malicious/Live@Edu password reset.ps1
Live@Edu password reset.ps1
#---------------------------------------------- #region Application Functions #---------------------------------------------- function OnApplicationLoad { #Note: This function runs before the form is created #Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path #No...
combined_dataset/train/non-malicious/1685.ps1
1685.ps1
function Get-MADObject { param ( [string]$name, [string]$description, [string]$searchroot, [ValidateSet($null,'user','group','computer')] $type ) if (!$name -and !$description -and !$searchroot -and !$type) { Throw 'Please provide a type, search ter...
combined_dataset/train/non-malicious/sample_28_74.ps1
sample_28_74.ps1
# # Module manifest for module 'OCI.PSModules.Aidocument' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Aidocument.dll' # Version number of this module. ModuleVersion = '83.2.0' # Supported PSEditions ...
combined_dataset/train/non-malicious/sample_5_69.ps1
sample_5_69.ps1
<# .SYNOPSIS Collects basic information about the installed instance of WSUS Server .DESCRIPTION Collects basic information about the installed instance of WSUS Server and generates two files: COMPUTERNAME_WSUS_BasicInfo.txt (Optional) COMPUTERNAME_WSUS_UpdateApprovals.txt .PARAMETER GetApprovedUpdates (Opt...
combined_dataset/train/non-malicious/Compare-TwitterNames_1.ps1
Compare-TwitterNames_1.ps1
#This script will compare the names of the people you follow on Twitter #and the people following you. It returns a comparison object consisting #of the Twitter name of a subject and a side indicator - #"<=" means that you are following a subject who is not following you, #"=>" means that you are followed by so...
combined_dataset/train/non-malicious/Select-Expand.ps1
Select-Expand.ps1
function Select-Expand { <# .Synopsis Like Select-Object -Expand, but with recursive iteration of a select chain .Description Takes a dot-separated series of properties to expand, and recursively iterates the output of each property ... .Parameter Property A collection of property names to expand. ...
combined_dataset/train/non-malicious/Start-Job proxy function.ps1
Start-Job proxy function.ps1
<# Example on how to use Proxy Cmdlets in combination with object events. For more information see: http://blog.powershell.no/2011/02/07/powershell-using-proxy-cmdlets-in-combination-with-object-events For more information about proxy functions, see the following article on the Microsoft PowerShell Team ...
combined_dataset/train/non-malicious/sample_41_91.ps1
sample_41_91.ps1
# # Module manifest for module 'OCI.PSModules.Datascience' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Datascience.dll' # Version number of this module. ModuleVersion = '73.1.0' # Supported PSEdition...
combined_dataset/train/non-malicious/4354.ps1
4354.ps1
function New-PackageSourceFromModuleSource { param ( [Parameter(Mandatory=$true)] $ModuleSource ) $ScriptSourceLocation = $null if(Get-Member -InputObject $ModuleSource -Name $script:ScriptSourceLocation) { $ScriptSourceLocation = $ModuleSource.ScriptSourceLocation }...
combined_dataset/train/non-malicious/1113.ps1
1113.ps1
$siteName = 'DefaultDocument' $sitePort = 4387 $webConfigPath = Join-Path $TestDir web.config function Start-TestFixture { & (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve) Install-IisAppPool -Name $siteName } function Stop-TestFixture { Uninstall-IisAppPool...
combined_dataset/train/non-malicious/2058.ps1
2058.ps1
Import-Module HelpersCommon Describe "Get-ExperimentalFeature Tests" -tags "Feature","RequireAdminOnWindows" { BeforeAll { $systemConfigPath = "$PSHOME/powershell.config.json" if ($IsWindows) { $userConfigPath = "~/Documents/powershell/powershell.config.json" } else ...
combined_dataset/train/non-malicious/Debug Regex match_1.ps1
Debug Regex match_1.ps1
function Debug-Regex { <# .SYNOPSIS A very simple function to debug a Regex search operation and show any 'Match' results. (V2.1 Export Alias db & some patterns, 28 Jan 2012). .DESCRIPTION Sometimes it is easier to correct any regex usage if each match can be shown in context. This function will show each su...
combined_dataset/train/non-malicious/sample_27_81.ps1
sample_27_81.ps1
# # Module manifest for module 'Microsoft.SME.ClusterCreation' # @{ # Script module or binary module file associated with this manifest. RootModule = 'Microsoft.SME.ClusterCreation.psm1' # Version number of this module. ModuleVersion = '2.124.1' # Supported PSEditions # CompatiblePSEditions = @() # ...
combined_dataset/train/non-malicious/Error handling PowerCLI.ps1
Error handling PowerCLI.ps1
$vmPath = "[Storage1] MyVM/MyVM.vmx" $vm = New-VM –VMHost "192.168.1.10" –VMFilePath $vmPath -Name MyVM # Check if there is an error and if so – handle it if (!$?) { if ($error[0].Exception –is [VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.DuplicateName]) { # A VM with the same name already exists. Ch...
combined_dataset/train/non-malicious/sample_6_96.ps1
sample_6_96.ps1
[dynamic, provider("dcismprovider"), Association, Aggregation, // Provider("cmpi:serviceprocessor"), Description ("LogicalDevices can be aggregated by a System. " "This relationship is made explicit by the SPSystemDevice association." ) ] class DCIM_SPSystemDevice : CIM_SystemDevice { [ ...
combined_dataset/train/non-malicious/3193.ps1
3193.ps1
function Get-InstalledSoftware { param ( [Parameter( Position = 0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, ValueFromRemainingArguments=$false )] [ValidateNotNullOrEmpty()] [Alias('CN','__SERVER','Server','Compu...
combined_dataset/train/non-malicious/sample_33_96.ps1
sample_33_96.ps1
[CmdletBinding()] param ( [Parameter(Mandatory)] [string]$Path, [Parameter()] [string]$Sha, [Parameter()] [string]$Before ) $string = "" if (![String]::IsNullOrEmpty($Before)) { try { $string = $($(git show "$($Before)^:$($Path)") -join "`r`n")3>&1 2>&1 } catch { ...
combined_dataset/train/non-malicious/sample_58_65.ps1
sample_58_65.ps1
@{ GUID="c61d6278-02a3-4618-ae37-a524d40a7f44 " Author="PowerShell" CompanyName="Microsoft Corporation" Copyright="Copyright (c) Microsoft Corporation." ModuleVersion="7.0.0.0" CompatiblePSEditions = @("Core") PowerShellVersion="3.0" ModuleToProcess="PSDiagnostics.psm1" Func...
combined_dataset/train/non-malicious/sample_38_54.ps1
sample_38_54.ps1
/*!--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *----------------------------------------------------------*/ define(["require", "exports", "Providers/CloudExplorer/Resources/CloudExplorerResources"], function (require, exports, CloudExplorer...
combined_dataset/train/non-malicious/sample_45_87.ps1
sample_45_87.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/Invoke-Command_1.ps1
Invoke-Command_1.ps1
Param($file,$cmd,[switch]$whatif,[switch]$verbose) Begin{ function Ping-Server { Param([string]$srv) $pingresult = Get-WmiObject win32_pingstatus -f "address='$srv'" if($pingresult.statuscode -eq 0) {$true} else {$false} } $servers = @() } Process{ if($_) { ...
combined_dataset/train/non-malicious/1360.ps1
1360.ps1
function New-CCredential { [CmdletBinding()] [OutputType([Management.Automation.PSCredential])] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams","")] param( [Alias('User')] [string] $UserName, [Parameter(Mandatory...
combined_dataset/train/non-malicious/sample_18_76.ps1
sample_18_76.ps1
ConvertFrom-StringData @' id_securitycenter=Windows Security Center id_securitycenterdesc=Running WMI queries to obtain antivirus and antispyware product registration information '@ # SIG # Begin signature block # MIIoQwYJKoZIhvcNAQcCoIIoNDCCKDACAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI...
combined_dataset/train/non-malicious/demo.ps1
demo.ps1
\n[45]: [IO.File]::ReadAllLines( "C:\\Users\\Joel\\Sites\\webalizer.current" ).Length 31873 [46]: (gc C:\\Users\\Joel\\Sites\\webalizer.current).Length 31873 [47]: gph 2 Duration Average Lines Words Chars Type Commmand -------- ------- ----- ----- ----- ---- -------- 0.07910 0.07910 1 3 73 Co...
combined_dataset/train/non-malicious/sample_29_6.ps1
sample_29_6.ps1
- comment: Sequence Diagram begin: \b(sequenceDiagram) beginCaptures: '1': name: keyword.control.pintora end: (^|\G)(?=\s*[`~]{3,}\s*$) patterns: - include: '#config__clause' - include: '#comment' - comment: '(title)' match: !regex |- (title)\s*(:)\s+ # title (\s*["\(...
combined_dataset/train/non-malicious/sample_3_98.ps1
sample_3_98.ps1
# # Module manifest for module 'OCI.PSModules.Oda' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Oda.dll' # Version number of this module. ModuleVersion = '92.1.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/sample_41_77.ps1
sample_41_77.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 Copy-ToTemp { ...
combined_dataset/train/non-malicious/75.ps1
75.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/sample_34_11.ps1
sample_34_11.ps1
# Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved. Function Get-AMTHardwareAsset { <# .Synopsis Shows hardware information about the system .Description This Cmdlet returns the hardware information from clients that have Intel Active Management Technology (AMT) firmware version 3.2 ...
combined_dataset/train/non-malicious/sample_55_13.ps1
sample_55_13.ps1
# # Module manifest for module 'OCI.PSModules.Announcementsservice' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Announcementsservice.dll' # Version number of this module. ModuleVersion = '86.0.0' # S...
combined_dataset/train/non-malicious/sample_14_79.ps1
sample_14_79.ps1
function Confirm-WACPMPrerequisitesInstalled { <# .SYNOPSIS Script that checks if prerequisites are installed .DESCRIPTION This script checks if Wireshark Dissector and Payload Parser are installed. These applications are required to parse ETL and ETW data captured by Packet Monitor .ROLE Readers #> f...
combined_dataset/train/non-malicious/sample_7_40.ps1
sample_7_40.ps1
ConvertFrom-StringData @' id_clusterinfo=Cluster Information id_clusterinfoobtaining=Obtaining cluster basic information id_clustername=Cluster Name id_clusterdomain=Cluster Domain id_clustercsv=Shared Volumes id_clustercsvroot=Shared Volumes Root '@ # SIG # Begin signature block # MIIoLQYJKoZIhvcNAQcCoIIoHj...
combined_dataset/train/non-malicious/sample_27_74.ps1
sample_27_74.ps1
# # Module manifest for module 'OCI.PSModules.Ocvp' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Ocvp.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported PSEditions CompatiblePS...
combined_dataset/train/non-malicious/1667.ps1
1667.ps1
function Remove-LocalAdmin { param ( [string]$comp, [string]$sam, [string]$domain = $env:USERDOMAIN ) if ($comp -match '^\s*$') { throw "Comp not found '$comp'" } if ($sam -match '^\s*$') { throw "Sam not acceptable '$sam'" } ([adsi]"WinNT://$comp/A...
combined_dataset/train/non-malicious/3821.ps1
3821.ps1
function Run-ComputeCloudExceptionTests { $rgname = Get-ComputeTestResourceName try { $loc = Get-ComputeVMLocation; New-AzResourceGroup -Name $rgname -Location $loc -Force; $compare = "*Resource*not found*OperationID : *"; Assert-ThrowsLike { $s1...
combined_dataset/train/non-malicious/sample_11_75.ps1
sample_11_75.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/sample_5_29.ps1
sample_5_29.ps1
#************************************************ # TS_RegistrySizeLimitCheck.ps1 # Version 1.0 # Date: 12-21-2011 # Author: v-anecho # Description: The RegistrySizeLimit entry exists in the registry. This may cause the computer to stop responding as well as log Event ID 333's in the System Event Log. #**********...
combined_dataset/train/non-malicious/ScheduledTasks_1.ps1
ScheduledTasks_1.ps1
# Windows Scheduled Tasks Management PowerShell Module # http://powershell.codeplex.com Function Get-ScheduledTasks { [CmdletBinding()] param ( [ValidateNotNullOrEmpty()] [string] $TaskName, [string] $HostName ) process { if ( $HostName ) { $HostName = "/S $HostName" } $ScheduledTasks = S...
combined_dataset/train/non-malicious/sample_66_79.ps1
sample_66_79.ps1
## Copyright (c) Microsoft Corporation. All rights reserved. <# .SYNOPSIS This cmdlet collects a performance recording of Microsoft Defender Antivirus scans. .DESCRIPTION This cmdlet collects a performance recording of Microsoft Defender Antivirus scans. These performance recordings contain Microsoft-Antimal...
combined_dataset/train/non-malicious/sample_35_13.ps1
sample_35_13.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/sample_15_11.ps1
sample_15_11.ps1
# # Module manifest for module 'OCI.PSModules.Ocicontrolcenter' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Ocicontrolcenter.dll' # Version number of this module. ModuleVersion = '75.1.0' # Supported...
combined_dataset/train/non-malicious/LibraryMSCS_3.ps1
LibraryMSCS_3.ps1
# ------------------------------------------------------------------------ ### <Script> ### <Author> ### Chad Miller ### </Author> ### <Description> ### Defines functions for working with Microsoft Cluster Service (MSCS) ### </Description> ### <Usage> ### . ./LibraryMSCS.ps1 ### </Usage> ### </Script> # --...
combined_dataset/train/non-malicious/sample_62_10.ps1
sample_62_10.ps1
# # Module manifest for module 'OCI.PSModules.Aivision' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Aivision.dll' # Version number of this module. ModuleVersion = '85.2.0' # Supported PSEditions Comp...
combined_dataset/train/non-malicious/1658.ps1
1658.ps1
function Get-LogonHistory { param ( [string]$Computer = $env:COMPUTERNAME, [int]$Days = 1 ) $filterXml = " <QueryList> <Query Id='0' Path='System'> <Select Path='System'> *[System[ Provider[@Name = 'Microsoft-Windows-Winlogon'] ...
combined_dataset/train/non-malicious/sample_61_64.ps1
sample_61_64.ps1
@{ GUID="c61d6278-02a3-4618-ae37-a524d40a7f44 " Author="PowerShell" CompanyName="Microsoft Corporation" Copyright="Copyright (c) Microsoft Corporation." ModuleVersion="7.0.0.0" CompatiblePSEditions = @("Core") PowerShellVersion="3.0" ModuleToProcess="PSDiagnostics.psm1" Func...
combined_dataset/train/non-malicious/3366.ps1
3366.ps1
[CmdletBinding()] Param ( [Parameter()] [string]$BuildConfig ="Debug" ) $output = Join-Path (Get-Item $PSScriptRoot).Parent.FullName "artifacts\$BuildConfig" Write-Verbose "The output folder is set to $output" $resourceManagerPath = $output $outputPaths = @($output) foreach ($path in $outputPaths) { Writ...
combined_dataset/train/non-malicious/3534.ps1
3534.ps1
$location = "southeastasia" $resourceGroupName = "pstestFSRG1bca8f8e" $vaultName = "PSTestFSRSV1bca8f8e" $fileShareFriendlyName = "pstestfs1bca8f8e" $fileShareName = "AzureFileShare;pstestfs1bca8f8e" $saName = "pstestsa1bca8f8e" $skuName="Standard_LRS" $policyName = "AFSBackupPolicy" ...
combined_dataset/train/non-malicious/sample_62_87.ps1
sample_62_87.ps1
# # Module manifest for module 'OCI.PSModules.Mysql' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Mysql.dll' # Version number of this module. ModuleVersion = '89.0.0' # Supported PSEditions Compatible...
combined_dataset/train/non-malicious/3092.ps1
3092.ps1
function Verify-Equal { param ( [Parameter(ValueFromPipeline = $true)] $Actual, [Parameter(Mandatory = $true, Position = 0)] $Expected ) if ($Expected -ne $Actual) { $message = "Expected and actual values differ!`n" + "Expected: '$Expected'`n" + "Actu...
combined_dataset/train/non-malicious/sample_61_11.ps1
sample_61_11.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_66_31.ps1
sample_66_31.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/474.ps1
474.ps1
function Convert-StringToScriptBlock{ param( [parameter(ValueFromPipeline=$true,Position=0)] [string] $String ) $ScriptBlock = [scriptblock]::Create($String) return $ScriptBlock }