full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/sample_1_22.ps1
sample_1_22.ps1
// Copyright (c) 2016 Dell Inc. or its subsidiaries. All Rights Reserved. // ================================================================== // DCIM_SystemPSDevice // ================================================================== [dynamic, provider("dcismprovider"), Association, Description( "DC...
combined_dataset/train/non-malicious/AD-GroupMembers_v2.ps1
AD-GroupMembers_v2.ps1
function AD-GroupMembers() { param ( $Domen, $Group, $User ) if ($User){$Connection = Get-Credential -Credential $user} if($Connection){$Member = Get-QADGroupMember -Service $Domen -Identity $Group -Credential $Connection -SizeLimit 0 -ErrorAction SilentlyContinue | Sort Name | Format-List Name,NTAccountName,Sid...
combined_dataset/train/non-malicious/Get-FirewallStatus2.ps1
Get-FirewallStatus2.ps1
filter global:get-firewallstatus2 ([string]$computer = $env:computername) { if ($_) { $computer = $_ } $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine",$computer) $firewallEnabled = $reg.OpenSubKey("System\\ControlSet001\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\DomainProfil...
combined_dataset/train/non-malicious/2693.ps1
2693.ps1
function Get-VirtualMemoryInfo { Param ( [Parameter(Position = 0, Mandatory = $True)] [ValidateScript({Get-Process -Id $_})] [Int] $ProcessID, [Parameter(Position = 1, Mandatory = $True)] [IntPtr] $ModuleBaseAddress, [Int] $PageSize = 0x100...
combined_dataset/train/non-malicious/1204.ps1
1204.ps1
Set-StrictMode -Version 'Latest' & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve) Describe 'Test-Service when testing an existing service' { $error.Clear() Get-Service | ForEach-Object { It ('should find the {0} {1} service' -f $_.ServiceName,$_.ServiceTyp...
combined_dataset/train/non-malicious/Locked accounts alerter.ps1
Locked accounts alerter.ps1
#Created By: Ty Lopes #Sept 2012 #Sript to be run by a scheduled task that monitors for a specific event ID (in this case account locked) #The sript then reads the last correstponding event ID and emails the details #I could only get this alert to work properly by using this method... There may be something easier/...
combined_dataset/train/non-malicious/310.ps1
310.ps1
function New-PSFLicense { [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low', HelpUri = 'https://psframework.org/documentation/commands/PSFramework/New-PSFLicense')] [OutputType([PSFramework.License.License])] param ( [Parameter(Mandatory = $true)] [String] $Product, [String] $Manufac...
combined_dataset/train/non-malicious/1628.ps1
1628.ps1
function Add-Zip { param ( [string]$sourceFile, [string]$zipFile ) begin { function Resolve-FullPath ([string]$Path) { if ( -not ([System.IO.Path]::IsPathRooted($Path)) ) { $Path = "$PWD\$Path" } [IO.Path...
combined_dataset/train/non-malicious/2653.ps1
2653.ps1
$helpers = @() $helpFunctions = Get-Command -CommandType Function | Where {$_.HelpUri -match "psappdeploytoolkit" -and $_.Definition -notmatch "internal script function"} | Select Name -ExpandProperty Name Foreach ($help in $helpFunctions) { $helpDetail = Get-Help $help -Detailed | Select Name,Synopsis,Description...
combined_dataset/train/non-malicious/Get-ImageMetaData_1.ps1
Get-ImageMetaData_1.ps1
function Get-ImageMetadata { #.Synopsis # pull EXIF, XMP, and other data from images using the BitmapMetaData #.Example # $image = Get-ImageMetadata C:\\Users\\JBennett\\Pictures\\3200x1200\\02179_piertonowhere_interfacelift_com.jpg -verbose # $image | fl *tiff* # $image | fl *exif* ## Usage: ls *.jpg | Get...
combined_dataset/train/non-malicious/Set-defaultBrowser.ps1
Set-defaultBrowser.ps1
function Set-defaultBrowser { param($defaultBrowser) switch ($defaultBrowser) { 'IE' { Set-ItemProperty 'HKCU:\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\ftp\\UserChoice' -name ProgId IE.FTP Set-ItemProperty 'HKCU:\\Software\\Microsoft\\Wind...
combined_dataset/train/non-malicious/Autoload (beta 3).ps1
Autoload (beta 3).ps1
#Requires -Version 2.0 ## Version History ## beta 3 - 2010.05.10 ## fix for signed scripts (strip signature) ## beta 2 - 2010.05.09 ## implement module support ## beta 1 - 2010.04.14 ## Initial Release ## Automatically load functions from scripts on-demand, instead of having to ...
combined_dataset/train/non-malicious/sample_46_78.ps1
sample_46_78.ps1
# # Module manifest for module 'OCI.PSModules.Cloudguard' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Cloudguard.dll' # Version number of this module. ModuleVersion = '80.0.0' # Supported PSEditions ...
combined_dataset/train/non-malicious/227.ps1
227.ps1
Function Lock-Computer { $signature = @" [DllImport("user32.dll", SetLastError = true)] public static extern bool LockWorkStation(); "@ $LockComputer = Add-Type -memberDefinition $signature -name "Win32LockWorkStation" -namespace Win32Functions -passthru $LockComputer::LockWorkStation() | Out-Null }
combined_dataset/train/non-malicious/sample_42_64.ps1
sample_42_64.ps1
<# .SYNOPSIS Demonstrates how to write a command that works with paths that do not allow wildards but must 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 does not ...
combined_dataset/train/non-malicious/282.ps1
282.ps1
$groupId = " FILL ME IN " $datasetId = " FILL ME IN " Login-PowerBI $uri = "groups/$groupId/datasets/$datasetId/Default.TakeOver" try { Invoke-PowerBIRestMethod -Url $uri -Method Post if (-Not $?) { $errmsg = Resolve-PowerBIError -Last $err...
combined_dataset/train/non-malicious/sample_18_26.ps1
sample_18_26.ps1
# # # Rule to look for organizations that are newer than the deployment # # Created: 5/24/2012 # Author: Jonathan Randall #****************************************************************************************************************** #region Functions function GetOrganizationData([string] $conn_string) ...
combined_dataset/train/non-malicious/1419.ps1
1419.ps1
function Get-CADDomainController { [CmdletBinding()] param( [string] $Domain ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState if( $Domain ) { $principalContext = $null ...
combined_dataset/train/non-malicious/4333.ps1
4333.ps1
function Get-PublishLocation { [CmdletBinding()] Param ( [Parameter()] [String] $Location ) $PublishLocation = $null if($Location) { if(Microsoft.PowerShell.Management\Test-Path -Path $Location) { $PublishLocation = $Location ...
combined_dataset/train/non-malicious/sample_48_53.ps1
sample_48_53.ps1
# Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved. Function Clear-AMT3PDS { <# .Synopsis Deletes data from the Intel Active Management Technology Third Party Data Storage .Description This CmdLet deletes data from the Intel Active Management Technology (AMT) Third Party Data Storag...
combined_dataset/train/non-malicious/Get-FreeRAM.ps1
Get-FreeRAM.ps1
function Get-FreeRam { #.Synopsis # Gets the FreePhysicalMemory from the specified computer(s) #.Parameter ComputerName # The name(s) of the computer(s) to get the Free Ram (FreePhysicalMemory) for. #.Example # Get-FreeRam SDI-JBennett, Localhost # # Computer FreePhysicalMemory # -------- ...
combined_dataset/train/non-malicious/80.ps1
80.ps1
function Get-AuthToken { [cmdletbinding()] param ( [Parameter(Mandatory=$true)] $User ) $userUpn = New-Object "System.Net.Mail.MailAddress" -ArgumentList $User $tenant = $userUpn.Host Write-Host "Checking for AzureAD module..." $AadModule = Get-Module -Name "AzureAD" -ListAvailable if ($Aad...
combined_dataset/train/non-malicious/sample_42_55.ps1
sample_42_55.ps1
<# .SYNOPSIS SyncShare.psd1 file This is a place-holder module file only for agent patch build purposes #> Write-Host "This module functionality is deprecated and is place-holder only" # SIG # Begin signature block # MIInwQYJKoZIhvcNAQcCoIInsjCCJ64CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEE...
combined_dataset/train/non-malicious/Migrate-ADMTUser_1.ps1
Migrate-ADMTUser_1.ps1
###########################################################################" # # NAME: Migrate-ADMTUser.ps1 # # AUTHOR: Jan Egil Ring # EMAIL: jan.egil.ring@powershell.no # # COMMENT: A function to migrate a single user in the Active Directory Migration Tool, based on the sample script Invoke-ADMTUserMigration.p...
combined_dataset/train/non-malicious/sample_45_80.ps1
sample_45_80.ps1
using namespace System.Management.Automation using namespace System.Management.Automation.Language # This is an example profile for PSReadLine. # # This is roughly what I use so there is some emphasis on emacs bindings, # but most of these bindings make sense in Windows mode as well. Import-Module PSReadLine ...
combined_dataset/train/non-malicious/sample_66_50.ps1
sample_66_50.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apa...
combined_dataset/train/non-malicious/Get-Cpl.ps1
Get-Cpl.ps1
function Get-Cpl { dir $env:windir\\system32 | Where-Object {$_.Extension -eq ".cpl"} | Select-Object Name,@{Name="Description";Expression={$_.VersionInfo.FileDescription}} | Sort-Object Description | Format-Table -AutoSize }
combined_dataset/train/non-malicious/2770.ps1
2770.ps1
$svctrigs = & $env:windir\system32\sc.exe query | ForEach-Object { $svc = $_ if ($svc -match "SERVICE_NAME:\s(.*)") { & $env:windir\system32\sc qtriggerinfo $($matches[1]) } }|?{$_.length -gt 1 -and $_ -notmatch "\[SC\] QueryServiceConfig2 SUCCESS|has not registered for any" } function Get-LogPr...
combined_dataset/train/non-malicious/sample_40_82.ps1
sample_40_82.ps1
/*--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ define("vs/languages/typescript/participants/filenameSuggestions.nls.keys",[],{}); // SIG // Begin signature block // SIG // MIIjiAYJ...
combined_dataset/train/non-malicious/sample_57_37.ps1
sample_57_37.ps1
Get-Service -DisplayName "Dell TechHub" | Start-Service # SIG # Begin signature block # MIIvMAYJKoZIhvcNAQcCoIIvITCCLx0CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB9fVTjCxy7nd/b # c2JDhnRLmvteuxXiugYqE6HxKZ...
combined_dataset/train/non-malicious/Chassis Type_1.ps1
Chassis Type_1.ps1
$system = Get-WMIObject -class Win32_systemenclosure $type = $system.chassistypes Switch ($Type) { "1" {"Chassis type is: $Type - Other"} "2" {"Chassis type is: $type - Virtual Machine"} "3" {"Chassis type is: $type - Desktop"} "4" {"Chassis type is: $type - Low Profile Desk...
combined_dataset/train/non-malicious/FTP upload.ps1
FTP upload.ps1
$File = "D:\\Dev\\somefilename.zip" $ftp = "ftp://username:password@example.com/pub/incoming/somefilename.zip" "ftp url: $ftp" $webclient = New-Object System.Net.WebClient $uri = New-Object System.Uri($ftp) "Uploading $File..." $webclient.UploadFile($Uri, $File)
combined_dataset/train/non-malicious/sample_8_37.ps1
sample_8_37.ps1
#************************************************ # DC_RAS-Component.ps1 # Version 1.0 # Collects registry and netsh information. # Version 1.1 # Commented out "ras show activeservers". <- On Win7, this caused a Windows Firewall prompt to allow RAS server advertisements # Commented out "ras show user" <- Th...
combined_dataset/train/non-malicious/66.ps1
66.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/3609.ps1
3609.ps1
function Get-User { return getAssetName } function Test-GetNonExistingUser { $rgname = Get-DeviceResourceGroupName $dfname = Get-DeviceName $name = Get-User Assert-ThrowsContains { Get-AzDataBoxEdgeUser -ResourceGroupName $rgname -DeviceName $dfname -Name $name } "not find" } function Tes...
combined_dataset/train/non-malicious/4173.ps1
4173.ps1
[CmdletBinding()] param () function Import-SCCMModule { [CmdletBinding()] param ( [ValidateNotNullOrEmpty()][string]$SCCMServer ) $Architecture = (get-wmiobject win32_operatingsystem -computername $SCCMServer).OSArchitecture $Uninstall = Invoke-Command -ComputerName $SCCMServer -ScriptBlock { Get-Chi...
combined_dataset/train/non-malicious/sample_30_87.ps1
sample_30_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/Compare-PathAcl.ps1
Compare-PathAcl.ps1
[CmdletBinding()] param( [string]$Path = 'C:\\', [string]$User1 = "$Env:USERDOMAIN\\$Env:UserName", [string]$User2 = "BuiltIn\\Administrators", [switch]$recurse ) foreach($fso in ls $path -recurse:$recurse) { $acl = @(get-acl $fso.FullName | select -expand Access | Where IdentityReference -in $user1,$user...
combined_dataset/train/non-malicious/sample_21_6.ps1
sample_21_6.ps1
function EnsureAdminPrivileges([String]$mesageOnError) { $identity = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = new-object Security.Principal.WindowsPrincipal $identity if (!($principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))) { Write-Error $m...
combined_dataset/train/non-malicious/Remove-AeroPeek.ps1
Remove-AeroPeek.ps1
function Remove-AeroPeek { PARAM( [string]$Title="*", [string]$Process="*" ) BEGIN { try { $null = [Huddled.DWM] } catch { Add-Type -Type @" using System; using System.Runtime.InteropServices; namespace Huddled { public static class Dwm { [DllImport("dwmapi.dll", PreserveSig = false...
combined_dataset/train/non-malicious/609.ps1
609.ps1
param( [string]$Version, [string]$Path, [switch]$Force, $Update, [switch]$Uninstall ) $Configs = @{ Version = "6.5.3" Url = "http://download.tuxfamily.org/notepadplus/6.5.3/npp.6.5.3.Installer.exe" Path = "$(Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)\" Executable = "C:\Progr...
combined_dataset/train/non-malicious/Out-CliXml.ps1
Out-CliXml.ps1
function Out-CliXml { <# .SYNOPSIS Creates an XML-based representation of an object or objects and outputs it as a string. .DESCRIPTION The Out-Clixml cmdlet creates an XML-based representation of an object or objects and outputs it as a string. This cmdlet is similar to Export-CliXml except it doesn't output t...
combined_dataset/train/non-malicious/sample_59_52.ps1
sample_59_52.ps1
# # Module manifest for module 'OCI.PSModules.Certificatesmanagement' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Certificatesmanagement.dll' # Version number of this module. ModuleVersion = '83.3.0' ...
combined_dataset/train/non-malicious/sample_52_15.ps1
sample_52_15.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 = '83.1.0' # Supported PSEditions Comp...
combined_dataset/train/non-malicious/sample_64_9.ps1
sample_64_9.ps1
<############################################################# # # # Copyright (C) Microsoft Corporation. All rights reserved. # # # #############################################################> ...
combined_dataset/train/non-malicious/545.ps1
545.ps1
function Set-SPOWebPermissions { [CmdletBinding()] param ( [Parameter(Mandatory=$true, Position=1)] [string]$groupname, [Parameter(Mandatory=$true, Position=2)] [string]$roleType ) process { Write-Host "Creating permissions for the web for the group $groupname and role $roleType" -foregroundcolor b...
combined_dataset/train/non-malicious/sample_65_74.ps1
sample_65_74.ps1
# # Copyright 2018-2024 HP Development Company, L.P. # All Rights Reserved. # # NOTICE: All information contained herein is, and remains the property of HP Development Company, L.P. # # The intellectual and technical concepts contained herein are proprietary to HP Development Company, L.P # and may be cove...
combined_dataset/train/non-malicious/sample_5_88.ps1
sample_5_88.ps1
ConvertFrom-StringData @' id_fltrfind=Machine Filter Drivers Information id_fltrfindrunning=Gathering information about upper and lower filters installed (Fltrfind) id_fltrfindoutput=Fltrfind Output id_fltrfindoutputdesc=Upper and lower filters information '@ # SIG # Begin signature block # MIIoRgYJKoZIhvcNAQc...
combined_dataset/train/non-malicious/1551.ps1
1551.ps1
function Get-MrAvailableDriveLetter { [CmdletBinding()] param ( [string[]]$ExcludeDriveLetter = ('A-F', 'Z'), [switch]$Random, [switch]$All ) $Drives = Get-ChildItem -Path Function:[a-z]: -Name if ($ExcludeDriveLetter) { $Drives = $Drives -notmatch "[$($Ex...
combined_dataset/train/non-malicious/sample_20_50.ps1
sample_20_50.ps1
# diag_uex.psm1 # Created by tdimli # March 2020 # # Diagnostic functions for UEX area # version $UEX_version = "1.0.240717.0" # Area and Area/Component arrays $UEX = @("xray_uex_wmi", "xray_uex_eventlog") #Component/Diagnostic Function arrays $xray_uex_wmi = @("uex_wmi_KB2020286") $xray_uex_eventlog =...
combined_dataset/train/non-malicious/sample_5_93.ps1
sample_5_93.ps1
# # Module manifest for module 'OCI.PSModules.Oce' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Oce.dll' # Version number of this module. ModuleVersion = '92.1.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/924.ps1
924.ps1
$resourceGroup = "myResourceGroup" $location = "westeurope" $vmName = "myVM" $securePassword = ConvertTo-SecureString ' ' -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential ("azureuser", $securePassword) New-AzResourceGroup -Name $resourceGroup -Location $location $subnetConfig = Ne...
combined_dataset/train/non-malicious/3576.ps1
3576.ps1
function Get-ResourceGroupName { return "RG-" + (getAssetName) } function Get-AdmAssetName { return "adm" + (getAssetName) } function Get-ProviderLocation($provider) { if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)...
combined_dataset/train/non-malicious/sample_62_38.ps1
sample_62_38.ps1
# # Copyright 2018-2024 HP Development Company, L.P. # All Rights Reserved. # # NOTICE: All information contained herein is, and remains the property of HP Development Company, L.P. # # The intellectual and technical concepts contained herein are proprietary to HP Development Company, L.P # and may be cove...
combined_dataset/train/non-malicious/f19ac581-ba99-480c-a4ec-92f9084f0d26.ps1
f19ac581-ba99-480c-a4ec-92f9084f0d26.ps1
Function Get-EmptyGroup { <# .Synopsis Retrieves all groups without members in a domain or container. .Description Retrieves all groups without members in a domain or container. .Notes Name : Get-EmptyGroup Author : Oliver Lipkau <oliv...
combined_dataset/train/non-malicious/sample_33_36.ps1
sample_33_36.ps1
<# .SYNOPSIS Update display scaling values for each monitor to match either (1) default system account or (2) current user .DESCRIPTION Make reg keys for the specified account match the default account or current user • HKCU\Control Panel\Desktop\PerMonitorSettings ...
combined_dataset/train/non-malicious/300.ps1
300.ps1
function Stop-PSFFunction { [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] [CmdletBinding(DefaultParameterSetName = 'Message', HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Stop-PSFFunction')] param ( [Parameter(Mandatory = $true, Par...
combined_dataset/train/non-malicious/New-ADSubnet.ps1
New-ADSubnet.ps1
param ($Subnet, $SiteName, $Location, [switch]$Help) function Help { "" Write-Host "Usage: .\\New-ADSubnet.ps1 -Help" -foregroundcolor Yellow Write-Host "Usage: .\\New-ADSubnet.ps1 <Subnet> <SiteName> <Location>" -foregroundcolor Yellow Write-Host "Ex: .\\New-ADSubnet.ps1 10.150.0.0/16 Default-First-Site-Name...
combined_dataset/train/non-malicious/1159.ps1
1159.ps1
$tempDir = $null $zipPath = $null $outputRoot = $null $PSCommandName = Split-Path -Leaf -Path $PSCommandPath function Start-TestFixture { & (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve) } function Start-Test { $tempDir = New-TempDir -Prefix ('{0}-{1}' -f $PSCom...
combined_dataset/train/non-malicious/PROMPT_ Battery life.ps1
PROMPT_ Battery life.ps1
# ============================================================================================== # # Microsoft PowerShell Source File -- Created with SAPIEN Technologies PrimalScript 2007 # # NAME: Battery-Prompt.ps1 # # AUTHOR: Jeremy D. Pavleck , Pavleck.NET # DATE : 12/18/2008 # # COMMENT: Lists the pe...
combined_dataset/train/non-malicious/Create-Printers_1.ps1
Create-Printers_1.ps1
###########################################################################" # # NAME: Create-Printers.ps1 # # AUTHOR: Jan Egil Ring # EMAIL: jan.egil.ring@powershell.no # BLOG: http://blog.powershell.no # # COMMENT: Simple script to bulk-create printers on a print-server. Printers are imported from a csv-file....
combined_dataset/train/non-malicious/Log Lost Pings.ps1
Log Lost Pings.ps1
# Logpings.ps1 # Version: 1.0 # Author: Jacob Saaby Nielsen # Author E-Mail: jsy@systematic.com # Purpose: Repeatedly ping a host, document lost pings to a logfile # Syntax: .\\Logpings hostname interval (where interval is a value representing seconds) # Requirements: /n Software's NetCmdlets http://www.nsoftware...
combined_dataset/train/non-malicious/110.ps1
110.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/Import-Certificate_7.ps1
Import-Certificate_7.ps1
#requires -Version 2.0 function Import-Certificate { param ( [IO.FileInfo] $CertFile = $(throw "Paramerter -CertFile [System.IO.FileInfo] is required."), [string[]] $StoreNames = $(throw "Paramerter -StoreNames [System.String] is required."), [switch] $LocalMachine, [switch] $CurrentUser, [string...
combined_dataset/train/non-malicious/sample_4_33.ps1
sample_4_33.ps1
#************************************************ # TS_WindowsSearchLenovoRapidBootCheck.ps1 # Version 1.0.1 # Date: 6/8/2012 # Author: v-alyao # Description: [Idea ID 3253] [Windows] Windows Search service does not start immediately after the machine is booted # Rule number: 3253 # Rule URL: http://sharepoin...
combined_dataset/train/non-malicious/Get-User_7.ps1
Get-User_7.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_52_93.ps1
sample_52_93.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_67_57.ps1
sample_67_57.ps1
# # Module manifest for module 'OCI.PSModules.Monitoring' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Monitoring.dll' # Version number of this module. ModuleVersion = '86.0.0' # Supported PSEditions ...
combined_dataset/train/non-malicious/925.ps1
925.ps1
$resourceGroup = "myResourceGroup" $location = "westeurope" $vmName = "myVM" $cred = Get-Credential -Message "Enter a username and password for the virtual machine." New-AzResourceGroup -Name $resourceGroup -Location $location New-AzVM ` -ResourceGroupName $resourceGroup ` -Name $vmName ` -Location $locati...
combined_dataset/train/non-malicious/2035.ps1
2035.ps1
Describe 'ProxyCommand Tests' -Tag 'CI' { BeforeAll { $testCases = @( @{ Name = 'ValidateLengthAttribute'; ParamBlock = '[ValidateLength(1, 10)][int]${Parameter}' } @{ Name = 'ValidateRangeAttribute with Minimum and Maximum'; ParamBlock = '[ValidateRange(1,...
combined_dataset/train/non-malicious/803.ps1
803.ps1
Describe "A dummy test" { Context "When a pester file is given" { It "Should return it symbols" { } It "Should return context symbols" { } It "Should return describe symbols" { } } }
combined_dataset/train/non-malicious/sample_11_59.ps1
sample_11_59.ps1
#$debug = $false # Load Common Library: . ./utils_cts.ps1 # Load DSD Common Function Library . ./utils_DSD.ps1 trap [Exception]{ WriteTo-StdOut "$($_.InvocationInfo.ScriptName)($($_.InvocationInfo.ScriptLineNumber)): $_" -shortformat; continue Write-Host "$($_.InvocationInfo.ScriptName)($($_.InvocationInfo...
combined_dataset/train/non-malicious/new get-parameter script.ps1
new get-parameter script.ps1
param ( $Cmdlet, [switch]$ShowCommon, [switch]$Full ) $command = Get-Command $Cmdlet -ea silentlycontinue # resolve aliases (an alias can point to another alias) while ($command.CommandType -eq "Alias") { $command = Get-Command ($command.definition) } if (-not $command) { return } foreach ($...
combined_dataset/train/non-malicious/f316d247-86b3-4eee-b61f-313e456fe5d5.ps1
f316d247-86b3-4eee-b61f-313e456fe5d5.ps1
# This is to remove the Hidden folder attribute and delete the autorun.inf and x.mpeg due to changeup virus! # 4-3-2013 John R Remillard # You need the exact root folder path to unhide and delete the proper files and folders. #$Pth = Read-Host "Enter full path to unhide" $Lst = Get-Content c:\\Shares.txt foreach (...
combined_dataset/train/non-malicious/2969.ps1
2969.ps1
function script:Start-NativeExecution([scriptblock]$sb, [switch]$IgnoreExitcode) { $backupEAP = $script:ErrorActionPreference $script:ErrorActionPreference = "Continue" try { & $sb if ($LASTEXITCODE -ne 0 -and -not $IgnoreExitcode) { throw "Execution of {$sb} ...
combined_dataset/train/non-malicious/sample_11_20.ps1
sample_11_20.ps1
##------------------------------------------------------------------ ## <copyright file="Disable-StandaloneObservability.ps1" company="Microsoft"> ## Copyright (C) Microsoft. All rights reserved. ## </copyright> ##------------------------------------------------------------------ $ErrorActionPreference = "S...
combined_dataset/train/non-malicious/Get-HardlinkInfo.ps1
Get-HardlinkInfo.ps1
# .SYNOPSIS # Returns information about NTFS hard links. Only available on Windows Vista or later. # # .DESCRIPTION # This script can be used to determine how many alternate file names (i.e. hard link # siblings) a particular file has or to return all hard link siblings as FileInfo # objects. It uses the Wi...
combined_dataset/train/non-malicious/sample_7_81.ps1
sample_7_81.ps1
[dynamic, provider("dcismprovider")] class DCIM_LocalRoleBasedAuthorizationService : CIM_RoleBasedAuthorizationService { [ Description ("CreationClassName indicates the name of the class or the subclass that is used in the creation of an instance. When used with the other key properties of this clas...
combined_dataset/train/non-malicious/2286.ps1
2286.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true, HelpMessage="Site server name with SMS Provider installed")] [parameter(ParameterSetName="Text")] [ValidateScript({Test-Connection -ComputerName $_ -Count 1 -Quiet})] [ValidateNotNullorEmpty()] [string]$SiteServer, [...
combined_dataset/train/non-malicious/Out-Html_1.ps1
Out-Html_1.ps1
################################################################################ # Out-HTML - converts module functions or cmdlet help to HTML format # Minor modification of Vegard Hamar's OUT-HTML to support modules instead of pssnapin's # Based on Out-wiki by Dimitry Sotnikov (http://dmitrysotnikov.wordpress.com/2...
combined_dataset/train/non-malicious/sample_2_80.ps1
sample_2_80.ps1
# # Module manifest for module 'OCI.PSModules.Generativeai' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Generativeai.dll' # Version number of this module. ModuleVersion = '93.0.0' # Supported PSEditi...
combined_dataset/train/non-malicious/Get-PrivateProfileString.ps1
Get-PrivateProfileString.ps1
#############################################################################\n##\n## Get-PrivateProfileString\n##\n## From Windows PowerShell Cookbook (O'Reilly)\n## by Lee Holmes (http://www.leeholmes.com/guide)\n##\n##############################################################################\n\n<#\n\n.SYNOPSIS\n\n...
combined_dataset/train/non-malicious/4405.ps1
4405.ps1
function Get-SourceLocation { [CmdletBinding()] [OutputType("string")] Param ( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $SourceName ) Set-ModuleSourcesVariable if($script:PSGetModuleSources.Contains($SourceName)) { return ...
combined_dataset/train/non-malicious/sample_0_23.ps1
sample_0_23.ps1
ConvertFrom-StringData @' id_clustercsvd=Cluster Shared Volume information id_clustercsvdesc=Obtaining information about Cluster Shared Volumes '@ # SIG # Begin signature block # MIIoPAYJKoZIhvcNAQcCoIIoLTCCKCkCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG ...
combined_dataset/train/non-malicious/sample_20_91.ps1
sample_20_91.ps1
ConvertFrom-StringData @' EnvironmentErrorAlreadyExists=Ya existe una variable de entorno con este nombre y tipo. EnvironmentErrorDoesNotExists=No existe una variable de entorno con este nombre y tipo. '@ # SIG # Begin signature block # MIIoOwYJKoZIhvcNAQcCoIIoLDCCKCgCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3...
combined_dataset/train/non-malicious/4237.ps1
4237.ps1
function Invoke-Sniffer { param( [String]$LocalIP = "NotSpecified", [String]$ScanIP="all", [String]$Protocol = "all", ` [String]$Port="all", [Int]$Seconds = 0, [switch]$ResolveHosts, [switch]$Help, [String]$OutputFile, $MaxSize) if( $Help ) { Write-Output "usage: $($MyInvocation.MYCommand) [-OutputFile <String>]...
combined_dataset/train/non-malicious/sample_30_56.ps1
sample_30_56.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 = '83.2.0' # Supported PSEditions CompatiblePS...
combined_dataset/train/non-malicious/sample_43_97.ps1
sample_43_97.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_36_69.ps1
sample_36_69.ps1
@{ RootModule = 'PSModule.psm1' ModuleVersion = '2.2.5' GUID = '1d73a601-4a6c-43c5-ba3f-619b18bbb404' Author = 'Microsoft Corporation' CompanyName = 'Microsoft Corporation' Copyright = '(c) Microsoft Corporation. All rights reserved.' D...
combined_dataset/train/non-malicious/Get-UNCPath.ps1
Get-UNCPath.ps1
function Get-UNCPath {param( [string]$HostName, [string]$LocalPath) $NewPath = $LocalPath -replace(":","$") #delete the trailing \\, if found if ($NewPath.EndsWith("\\")) { $NewPath = [Text.RegularExpressions.Regex]::Replace($NewPath, "\\\\$", "") } "\\\\$HostName\\$NewPath" }
combined_dataset/train/non-malicious/Import-Certificate_6.ps1
Import-Certificate_6.ps1
#requires -Version 2.0 function Import-Certificate { param ( [IO.FileInfo] $CertFile = $(throw "Paramerter -CertFile [System.IO.FileInfo] is required."), [string[]] $StoreNames = $(throw "Paramerter -StoreNames [System.String] is required."), [switch] $LocalMachine, [switch] $CurrentUser, [string...
combined_dataset/train/non-malicious/Get-SpecialPath.ps1
Get-SpecialPath.ps1
############################################################################### ## Get-SpecialPath Function (should be an external function in your profile, really) ## This is an enhancement of [Environment]::GetFolderPath($folder) to add ## support for 8 additional folders, including QuickLaunch, and the commo...
combined_dataset/train/non-malicious/3419.ps1
3419.ps1
function Test-CreatesNewSimpleResourceGroup { $rgname = Get-ResourceGroupName $location = Get-ProviderLocation ResourceManagement try { $actual = New-AzureRmResourceGroup -Name $rgname -Location $location -Tags @{ testtag = "testval"} -Force $expected = Get...
combined_dataset/train/non-malicious/4359.ps1
4359.ps1
function Set-InstalledScriptsVariable { $script:PSGetInstalledScripts = [ordered]@{} $scriptPaths = @($script:ProgramFilesInstalledScriptInfosPath, $script:MyDocumentsInstalledScriptInfosPath) foreach ($location in $scriptPaths) { $scriptInfoFiles = Get-ChildItem -Path $location `...
combined_dataset/train/non-malicious/sample_16_33.ps1
sample_16_33.ps1
# # Module manifest for module 'OCI.PSModules.Stackmonitoring' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Stackmonitoring.dll' # Version number of this module. ModuleVersion = '75.1.0' # Supported P...
combined_dataset/train/non-malicious/PowerCLI error report.ps1
PowerCLI error report.ps1
$moveVmScript = { Connect-VIServer yourVCenterServer Move-VM WinXP -Location yourDestinationHost } $ moveVmScript | Get-ErrorReport -ProblemScriptTimeoutSeconds 120 -ProblemDescription "An error is returned by Move-VM. The operation should be successful. The same can be done via the vClient." -Destination 'D:\\b...
combined_dataset/train/non-malicious/sample_50_41.ps1
sample_50_41.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/3615.ps1
3615.ps1
function Test-setup { $global:ruleName = Get-ResourceName $global:ruleName2 = Get-ResourceName $global:ruleName3 = Get-ResourceName $global:resourceGroupName = Get-ResourceGroupName $global:location = Get-ProviderLocation("microsoft.insights") $global:description = "SQR log alert rule" $global:sev...
combined_dataset/train/non-malicious/sample_2_44.ps1
sample_2_44.ps1
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object...
combined_dataset/train/non-malicious/Function Run-Script_4.ps1
Function Run-Script_4.ps1
################################################################################# # This function should be included in the PowerShell ISE profile.ps1 and it will # display the start and end times of any scripts started by clicking 'Run Script' # in the Add-ons Menu, or F2; additionally they will be logged to the S...