full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/PS2WCF.ps1 | PS2WCF.ps1 | # Call WCF Services With PowerShell V1.0 22.12.2008
#
# by Christian Glessner
# Blog: http://www.iLoveSharePoint.com
# Twitter: http://twitter.com/cglessner
# Codeplex: http://codeplex.com/iLoveSharePoint
#
# requires .NET 3.5
# load WCF assemblies
[void][System.Reflection.Assembly]::LoadWithPartialName("Sy... |
combined_dataset/train/non-malicious/sample_10_83.ps1 | sample_10_83.ps1 | #************************************************
# DC_DiskInfo.ps1
# Version 1.0
# Date: 09-05-2023
# Author: Edmund Spatariu
# Updated:
# Description: This script obtains Disk Info and associate a drive letter with corresponding LUN, saving output to a
# file named $ComputerName_DC_DiskInfo.txt
... |
combined_dataset/train/non-malicious/sample_57_34.ps1 | sample_57_34.ps1 | $timestamp = get-date -uformat %Y%m%d-%k%M%S
$transcriptPath = "$($env:temp)\StorageSyncAgent-SetRegPIIAclSettings-$($timestamp).log"
Start-Transcript -Path $transcriptPath
# The following script removes read permissions from registry key locations which may contain PII information.
$regPaths = 'HKLM:\Software\Mi... |
combined_dataset/train/non-malicious/sample_62_51.ps1 | sample_62_51.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/3869.ps1 | 3869.ps1 |
function Test-CreateNewWebAppBackup
{
$rgName = Get-ResourceGroupName
$wName = Get-WebsiteName
$location = Get-Location
$whpName = Get-WebHostPlanName
$backupName = Get-BackupName
$tier = "Standard"
$stoName = 'sto' + $rgName
$stoContainerName = 'container' + $rgName
... |
combined_dataset/train/non-malicious/sample_36_6.ps1 | sample_36_6.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_63_5.ps1 | sample_63_5.ps1 | function ISFrontDoorCdnProfile([string]$SkuName) {
if ($SkuName -eq [Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.SkuName]::PremiumAzureFrontDoor -or
$SkuName -eq [Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.SkuName]::StandardAzureFrontDoor) {
return $true
}else{
return $false
... |
combined_dataset/train/non-malicious/Resize-Image.ps1 | Resize-Image.ps1 | ## NOTE: Destination must end in .bmp, .gif, .png, .wmp, .jpeg or .tiff
param($source = "C:\\Windows\\Web\\Wallpaper\\Windows\\img0.jpg", $destination = "$Home\\Pictures\\thumb0.png", $scale = 0.25)
Add-Type -Assembly PresentationCore
## Open and resize the image
$image = New-Object System.Windows.Media.Imaging.T... |
combined_dataset/train/non-malicious/Map a Network Drive_1.ps1 | Map a Network Drive_1.ps1 | function MapNetDrive
{
param(
#Non-Boolean parameters (Values)
#
[Parameter(Position=0,Mandatory=$true)]
[string]$DriveLetter="Z:",
[Parameter(Position=1,Mandatory=$true)]
[string]$Path,
#Boolean switches (On/Off)
#
[Parameter(Position=2,Mandatory=$false)]... |
combined_dataset/train/non-malicious/275.ps1 | 275.ps1 |
function Get-ComputerInfo
{
[CmdletBinding()]
PARAM(
[Parameter(ValueFromPipeline=$true)]
[String[]]$ComputerName = "LocalHost",
[String]$ErrorLog = ".\Errors.log",
[Alias("RunAs")]
[System.Management.Automation.Credential()]$Credential = [System.Management.Automation.PSCredential]::Emp... |
combined_dataset/train/non-malicious/361.ps1 | 361.ps1 | function Set-PSFResultCache
{
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")]
[CmdletBinding(HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Set-PSFResultCache')]
param
(
[Parameter(Mandatory = $true, ValueFromPipeline = $true, Position... |
combined_dataset/train/non-malicious/List AD Users CSV_2.ps1 | List AD Users CSV_2.ps1 | $NumDays = 0
$LogDir = ".\\User-Accounts.csv"
$currentDate = [System.DateTime]::Now
$currentDateUtc = $currentDate.ToUniversalTime()
$lltstamplimit = $currentDateUtc.AddDays(- $NumDays)
$lltIntLimit = $lltstampLimit.ToFileTime()
$adobjroot = [adsi]''
$objstalesearcher = New-Object System.DirectoryServices.Dire... |
combined_dataset/train/non-malicious/NIC Performance.ps1 | NIC Performance.ps1 | $cat = New-Object system.Diagnostics.PerformanceCounterCategory("Network Interface")
$inst = $nic.GetInstanceNames()
foreach ( $nic in $inst ) {
$a = $nic.GetCounters( $nic )
$a | ft CounterName, { $_.NextValue() } -AutoSize
}
|
combined_dataset/train/non-malicious/sample_23_94.ps1 | sample_23_94.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
function Register-EditorCommand {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Name,
... |
combined_dataset/train/non-malicious/sample_31_78.ps1 | sample_31_78.ps1 | <#
.SYNOPSIS
Script that installs Salt into the Python environment
.DESCRIPTION
This script prepares the salt build directory for packaging by staging files
needed by the installer or zip file. It also removes unneeded execution and
state modules
It is after this script runs that we can create the ZipFile for the One... |
combined_dataset/train/non-malicious/sample_18_5.ps1 | sample_18_5.ps1 | #
# Module manifest for module 'Microsoft.SME.Firewall'
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'Microsoft.SME.Firewall.psm1'
# Version number of this module.
ModuleVersion = '4.10.0'
# Supported PSEditions
# CompatiblePSEditions = @()
# ID used to uniq... |
combined_dataset/train/non-malicious/sample_39_61.ps1 | sample_39_61.ps1 | # Copyright (C) Intel Corporation, 2021 All Rights Reserved.
function Invoke-DisableTLSAuthentication
{
<#
.Synopsis
Disables the TLS connection in AMT.
.Description
This cmdlet disables the TLS connection in AMT. (server or mutual)
.Notes
AMT Provisioning:
The vPro client AMT ... |
combined_dataset/train/non-malicious/899.ps1 | 899.ps1 | $appdirectory="<Replace with your app directory>"
$webappname="mywebapp$(Get-Random)"
$location="West Europe"
New-AzResourceGroup -Name myResourceGroup -Location $location
New-AzAppServicePlan -Name $webappname -Location $location `
-ResourceGroupName myResourceGroup -Tier Free
New-AzWebApp -Name $webappname -Loc... |
combined_dataset/train/non-malicious/sample_12_64.ps1 | sample_12_64.ps1 | ConvertFrom-StringData @'
id_adapterkb980486check=Checking 6to4 and physical adapters
id_adapterkb980486checkdesc=Checking the number of 6to4 and physical adapters (KB 980486)
'@
# SIG # Begin signature block
# MIIoUgYJKoZIhvcNAQcCoIIoQzCCKD8CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3Ag... |
combined_dataset/train/non-malicious/sample_30_28.ps1 | sample_30_28.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 = '75.1.0'
# Suppo... |
combined_dataset/train/non-malicious/2027.ps1 | 2027.ps1 |
Describe "Remote session configuration RoleDefintion RoleCapabilityFiles key tests" -Tags "Feature" {
BeforeAll {
if (!$IsWindows)
{
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
$PSDefaultParameterValues["it:skip"] = $true
}
else... |
combined_dataset/train/non-malicious/Get-DPMRecoveryPointRepo.ps1 | Get-DPMRecoveryPointRepo.ps1 | <#
.SYNOPSIS
Get-DPMRecoveryPointReport
.DESCRIPTION
This script sets up the basic framework that I use for all my scripts.
.PARAMETER DPMServerName
The FQDN of your DPM server
.EXAMPLE
Get-DPMRecoveryPointReport -DPMServerName dpm.company.com
N... |
combined_dataset/train/non-malicious/88.ps1 | 88.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_29_13.ps1 | sample_29_13.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 = '81.0.0'
... |
combined_dataset/train/non-malicious/Logger.psm1 0.2.ps1 | Logger.psm1 0.2.ps1 | <#
Name : Universal Log4Net Logging Module (Logger.psm1)
Version : 0.2
Author : Joel Bennett (MVP)
Site : http://www.HuddledMasses.org/
Version History:
0.2 - Configless release.
Now configures with inline XML, and supports switches to create "reasonable" default loggers
... |
combined_dataset/train/non-malicious/foreach-withexception.ps1 | foreach-withexception.ps1 | function foreach-withexception ([scriptblock]$process,$outputexception)
{
begin { $global:foreachex = @() }
process {
try
{
$local:inputitem = $_
&$process
}
catch
{
$local:exceptionitem = 1 | select-object... |
combined_dataset/train/non-malicious/256.ps1 | 256.ps1 | Function Add-SCSMServiceRequestComment
{
param (
[parameter(Mandatory = $True, Position = 0)]
$SRObject,
[parameter(Mandatory = $True, Position = 1)]
$Comment,
[parameter(Mandatory = $True, Position = 2)]
$EnteredBy,
[parameter(Mandatory = $False, Position ... |
combined_dataset/train/non-malicious/2983.ps1 | 2983.ps1 | Set-StrictMode -Version Latest
$functionName = '01c1a57716fe4005ac1a7bf216f38ad0'
try {
Describe 'Mocking Global Functions - Part Two' {
It 'Restored the global function properly' {
$globalFunctionExists = Test-Path Function:\global:$functionName
$globalFunctionExists | Should ... |
combined_dataset/train/non-malicious/Convert Raw SID to SID_2.ps1 | Convert Raw SID to SID_2.ps1 | #For intel concerning how to convert raw hex SID to Standard SID got to
#http://blogs.msdn.com/b/oldnewthing/archive/2004/03/15/89753.aspx
#to convert Hex to Dec
function Convert-HEXtoDEC
{
param($HEX)
ForEach ($value in $HEX)
{
[string][Convert]::ToInt32($value,16)
}
}
#to reassort decimal values to co... |
combined_dataset/train/non-malicious/sample_37_12.ps1 | sample_37_12.ps1 | <#
.SYNOPSIS
Finds the repositories registered with PowerShellGet and registers them for PSResourceGet.
#>
function Import-PSGetRepository {
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
# Use the -Force switch to overwrite existing repositories.
[switch... |
combined_dataset/train/non-malicious/sample_2_34.ps1 | sample_2_34.ps1 | param( [string]$DataPath, `
[switch]$AcceptEula, `
[switch]$Trace, `
[switch]$Logs, `
[switch]$Activity, `
[switch]$Fwd, `
[switch]$FwdCli, `
[switch]$RemShell, `
[switch]$HTTPSYS, `
[switch]$WinHTTP, `
[switch]$CAPI, `
[switch]$Ker... |
combined_dataset/train/non-malicious/sample_43_94.ps1 | sample_43_94.ps1 | #
# Module manifest for module 'Az.Kusto'
#
# Generated by: Microsoft Corporation
#
# Generated on: 23/04/2024
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'Az.Kusto.psm1'
# Version number of this module.
ModuleVersion = '2.3.1'
# Supported PSEditions
Compa... |
combined_dataset/train/non-malicious/1311.ps1 | 1311.ps1 |
function Get-CIPAddress
{
[CmdletBinding(DefaultParameterSetName='NonFiltered')]
param(
[Parameter(ParameterSetName='Filtered')]
[Switch]
$V4,
[Parameter(ParameterSetName='Filtered')]
[Switch]
$V6
)
Set-StrictMode -Version 'Latest... |
combined_dataset/train/non-malicious/sample_36_63.ps1 | sample_36_63.ps1 | #
# Module manifest for module 'OCI.PSModules.Core'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Core.dll'
# Version number of this module.
ModuleVersion = '81.0.0'
# Supported PSEditions
CompatiblePS... |
combined_dataset/train/non-malicious/2501.ps1 | 2501.ps1 |
param(
$SQLServer = 'PSQLDLS30'
)
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$DataSet = New-Object System.Data.DataSet
$SqlConnection.ConnectionString = "Server=$SQLServer;Datab... |
combined_dataset/train/non-malicious/466.ps1 | 466.ps1 |
$TypeAliasTable = @{
PSFComputer = "PSFramework.Parameter.ComputerParameter"
PSFComputerParameter = "PSFramework.Parameter.ComputerParameter"
PSFDateTime = "PSFramework.Parameter.DateTimeParameter"
PSFDateTimeParameter = "PSFramework.Parameter.DateTimeParameter"
PSFEncoding = "PSFramework.Parame... |
combined_dataset/train/non-malicious/Snippet Compiler.ps1 | Snippet Compiler.ps1 | $def = (gci $MyInvocation.MyCommand.Name).Directory.ToString()
#################################################################################################
$mnuAtom_Click= {
if ($txtEdit.Text -ne "") {
$res = [Windows.Forms.MessageBox]::Show("Do you want to save data before?", `
$fr... |
combined_dataset/train/non-malicious/3461.ps1 | 3461.ps1 |
function Test-DataFlowDebugScenario
{
$dfname = Get-DataFactoryName
$rgname = Get-ResourceGroupName
$rglocation = Get-ProviderLocation ResourceManagement
$dflocation = Get-ProviderLocation DataFactoryManagement
New-AzResourceGroup -Name $rgname -Location $rglocation -Force
... |
combined_dataset/train/non-malicious/sample_36_11.ps1 | sample_36_11.ps1 | #
# Module manifest for module 'OCI.PSModules.Waa'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Waa.dll'
# Version number of this module.
ModuleVersion = '77.0.0'
# Supported PSEditions
CompatiblePSEd... |
combined_dataset/train/non-malicious/sample_47_79.ps1 | sample_47_79.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_53_7.ps1 | sample_53_7.ps1 | <#
.SYNOPSIS Launch Developer PowerShell
.DESCRIPTION
Locates and imports a Developer PowerShell module and calls the Enter-VsDevShell cmdlet. The Developer PowerShell module
is located in one of several ways:
1) From a path in a Visual Studio installation
2) From the latest installation of Visual Studio (hig... |
combined_dataset/train/non-malicious/sample_43_13.ps1 | sample_43_13.ps1 | [CmdletBinding()]
param
(
[Parameter(Mandatory, ValueFromPipeline)]
[string]$Path,
[Parameter()]
[string]$After
)
Import-Module $(Join-Path $PSSCriptRoot Helpers.psm1)
if (!(Test-Empty $After)) {
$fileLog = $(git log -p -U10000 --output-indicator-new=~ --output-indicator-old=^ --... |
combined_dataset/train/non-malicious/Get-LocalGroupMember_4.ps1 | Get-LocalGroupMember_4.ps1 | function Get-LocalGroupMember
{
<#
.Synopsis
Get the local group membership.
.Description
Get the local group membership.
.Parameter ComputerName
Name of the Computer to get group members (Default localhost.)
.Parameter Group
... |
combined_dataset/train/non-malicious/Query MagisterWebservice.ps1 | Query MagisterWebservice.ps1 | <#
.TITLE
Haal-WisMasLeerling.ps1
.AUTHOR
Paul Wiegmans (p [dot] wiegmans [at] bonhoeffer [dot] nl)
.DATE
2013-01-30
.DESCRIPTION
Send a webquery to Schoolmaster Magister web service and request data
from the list WISMASLEERLING.
Doe een webquery naar Magister webservice en haal de lijst ... |
combined_dataset/train/non-malicious/sample_24_78.ps1 | sample_24_78.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 = '75.1.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/Disable AD Users.ps1 | Disable AD Users.ps1 | $NumDays = 90
$LogDir = ".\\Disabled-User-Accounts.log"
$currentDate = [System.DateTime]::Now
$currentDateUtc = $currentDate.ToUniversalTime()
$lltstamplimit = $currentDateUtc.AddDays(- $NumDays)
$lltIntLimit = $lltstampLimit.ToFileTime()
$adobjroot = [adsi]''
$objstalesearcher = New-Object System.DirectorySer... |
combined_dataset/train/non-malicious/sample_59_76.ps1 | sample_59_76.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/User Entitlement Auditor.ps1 | User Entitlement Auditor.ps1 | $date = ( get-date ).ToString('yyyy-MM-dd-hh-mm')
$inpath = "C:\\InputDir\\"
$outpath = "C:\\Archive\\"
$FileList = @(Get-Childitem $inpath)
# Output CSV formatted report with members properly split up and unwanted domains/users removed:
$ResultFile = [System.IO.Path]::GetTempFileName()
$ADMembersOutfil... |
combined_dataset/train/non-malicious/sample_0_98.ps1 | sample_0_98.ps1 | #************************************************
# DC_ClusterLogs.PS1
# Version 2.3.5
# Date: 02-09-2012
# Author: Andre Teixeira - andret@microsoft.com
# Description: This script is used to obtain cluster logs from both nodes (Windows Server 2008 R2) or from the local machine (pre-2K8R2)
#**********************... |
combined_dataset/train/non-malicious/sample_57_31.ps1 | sample_57_31.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_15_57.ps1 | sample_15_57.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 = '73.1.0'
# Supported PSEditions
Compatib... |
combined_dataset/train/non-malicious/sample_36_46.ps1 | sample_36_46.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/4104.ps1 | 4104.ps1 |
cls
$Global:OS
Function GetOSArchitecture{
$Global:OS=Get-WMIObject win32_operatingsystem
}
$DisplayOutput = $false
GetOSArchitecture
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
$Output... |
combined_dataset/train/non-malicious/1298.ps1 | 1298.ps1 |
function Test-CIPAddress
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[Net.IPAddress]
$IPAddress
)
Set-StrictMode -Version 'Latest'
Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState
$ip = Get-CIPAddress | Where-Obj... |
combined_dataset/train/non-malicious/sample_28_63.ps1 | sample_28_63.ps1 | #
# Module manifest for module 'OCI.PSModules.Visualbuilder'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Visualbuilder.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Supported PSEdi... |
combined_dataset/train/non-malicious/sample_14_66.ps1 | sample_14_66.ps1 | #
# Module manifest for module 'PSGet_AzStackHci.EnvironmentChecker'
#
# Generated by: Microsoft Corporation
#
# Generated on: 19/01/2022
#
@{
# Script module or binary module file associated with this manifest.
RootModule = ''
# Version number of this module.
ModuleVersion = '1.2100.25... |
combined_dataset/train/non-malicious/Invoke-V2Script.ps1 | Invoke-V2Script.ps1 | # Function may be useful for people who want to play with CTP1 for PowerShell 3 but need to use v2 scripts.
function Invoke-V2Script {
<#
.Synopsis
Will run script currently edited in ISE using powershell V2.
.Description
Will run script currently edited ISE. If it's not saved - it wil... |
combined_dataset/train/non-malicious/sample_16_70.ps1 | sample_16_70.ps1 | #
# Module manifest for module 'OCI.PSModules.Databasetools'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Databasetools.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Supported PSEdi... |
combined_dataset/train/non-malicious/4160.ps1 | 4160.ps1 |
Set-Variable -Name Errors -Value $null -Scope Global -Force
Set-Variable -Name LogFile -Value $Env:windir"\Logs\BuildLogs\CCTK.log" -Scope Global -Force
Set-Variable -Name BuildLog -Value $Env:windir"\Logs\BuildLogs\Build.log" -Scope Global -Force
Set-Variable -Name RelativePath -Scope Global -Force
Function Consol... |
combined_dataset/train/non-malicious/Pivot-Object.ps1 | Pivot-Object.ps1 | #.Synopsis
# Pivot multiple objects which have properties that are name, value pairs
#.Description
# Takes a series of objects where there are multiple rows which have a pair of columns where the values are different on ech row with the name and value of an additional property, and outputs new objects which have t... |
combined_dataset/train/non-malicious/sample_35_18.ps1 | sample_35_18.ps1 | <#
.SYNOPSIS
Powershell script to collect data about Geneva Metrics (AKA MDM, AKA Geneva Hot Path) data publication.
.DESCRIPTION
This script performs several operations for troubleshooting issues related to MetricsExtension such as:
- Collection of metric traffic.
- Collectio of information about... |
combined_dataset/train/non-malicious/Poshboard Inactive AD Ac.ps1 | Poshboard Inactive AD Ac.ps1 | @@ # UpdateADPC.ps1, to be run outside of Poshboard
function Get-DomainComputerAccounts
{
# Use Directory Services object to attach to the domain
$searcher = new-object DirectoryServices.DirectorySearcher([ADSI]"")
#Leaving the ADSI statement empty = attach to your root domain
# Filter down to computer accou... |
combined_dataset/train/non-malicious/sample_9_6.ps1 | sample_9_6.ps1 | ConvertFrom-StringData @'
progressbar_id_turnofffetchthrottling_exists=Verifying TurnOffFetchThrottling Registry Setting
progressbar_id_turnofffetchthrottling_existsdesc=Determining setting of TurnOffFetchThrottling registry value
'@
# SIG # Begin signature block
# MIIoUgYJKoZIhvcNAQcCoIIoQzCCKD8CAQExDzANBglghkg... |
combined_dataset/train/non-malicious/Test-WebDAV.ps1 | Test-WebDAV.ps1 | function Test-WebDav ()
{
param ( $Url = "$( throw 'URL parameter is required.')" )
$xhttp = New-Object -ComObject msxml2.xmlhttp
$xhttp.open("OPTIONS", $url, $false)
$xhttp.send()
if ( $xhttp.getResponseHeader("DAV") ) { $true }
else { $false }
}
|
combined_dataset/train/non-malicious/sample_28_49.ps1 | sample_28_49.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_63_59.ps1 | sample_63_59.ps1 | <# Script name: tss_DAclient-collector.ps1
Purpose: - a script you can use to generate the same information that the DCA generates for DirectAccess
see also DARA: DirectAccess troubleshooting guide https://internal.evergreen.microsoft.com/en-US/help/2921221
#>
param(
[Parameter(Mandatory=$False,Position=0,Help... |
combined_dataset/train/non-malicious/4229.ps1 | 4229.ps1 | function Get-WLANPass
{
$netsh = (netsh wlan show profiles)
$netsh | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NA... |
combined_dataset/train/non-malicious/Close by window title_1.ps1 | Close by window title_1.ps1 | using System;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.Diagnostics;
using System.Windows.Forms;
using System.ComponentModel;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CloseByTitle")]
[assembly: AssemblyVersion("3.5.0.0")]
namespace CloseByTitle {... |
combined_dataset/train/non-malicious/233.ps1 | 233.ps1 | function Get-SCSMWorkItemAssignedUser
{
[CmdletBinding(DefaultParameterSetName = 'GUID')]
param
(
[Parameter(ParameterSetName = 'SMObject',
Mandatory = $true,
ValueFromPipeline = $true)]
$SMObject,
[Parameter(ParameterSetName = 'GUID',
Mandatory = $true)]
$Guid
)
BEGIN
{
Import-... |
combined_dataset/train/non-malicious/2312.ps1 | 2312.ps1 | function ConvertMySqlRow-ToJson
{
[CmdletBinding()]
[OutputType('System.IO.FileInfo')]
param
(
[Parameter(Mandatory, ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[System.Data.DataRow[]]$Row,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[ValidatePattern('\.json$')]
[ValidateScript({ -not... |
combined_dataset/train/non-malicious/289.ps1 | 289.ps1 | function Register-PSFTaskEngineTask
{
[CmdletBinding(HelpUri = 'https://psframework.org/documentation/commands/PSFramework/Register-PSFTaskEngineTask')]
Param (
[Parameter(Mandatory = $true)]
[string]
$Name,
[string]
$Description,
[Parameter(Mandatory = $true)]
[System.Management.Automation.Scri... |
combined_dataset/train/non-malicious/4107.ps1 | 4107.ps1 |
[CmdletBinding()]
param
(
[string]$PSConsoleTitle = 'PowerShell Configuration'
)
function Set-ConsoleTitle {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)][String]$ConsoleTitle
)
$host.ui.RawUI.WindowTitle = $ConsoleTitle
}
function Get-RelativePath {
[CmdletBinding()][OutputType([string... |
combined_dataset/train/non-malicious/1988.ps1 | 1988.ps1 |
Describe "GetDateFormatUpdates" -Tags "Feature" {
It "Verifies that FileDate format works" {
$date = Get-Date
$expectedFormat = "{0:yyyyMMdd}" -f $date
$actualFormat = Get-Date -Date $date -Format FileDate
$actualFormat | Should -Be $expectedFormat
}
It "Verifies that Fi... |
combined_dataset/train/non-malicious/sample_53_23.ps1 | sample_53_23.ps1 | # Localized 04/01/2024 05:01 AM (GMT) 303:7.2.30118 CL_LocalizationData.psd1
ConvertFrom-StringData @'
###PSLOC
Troubleshoot_Title=Troubleshooting
Troubleshoot_DetectNetworkCache=Checking Windows Media Player network cache ...
Resolution_Title=Resolution
Resolution_ResetConfiguration=Resetting all configuration ... |
combined_dataset/train/non-malicious/sample_18_72.ps1 | sample_18_72.ps1 | @{
GUID = "A94C8C7E-9810-47C0-B8AF-65089C13A35A"
Author = "PowerShell"
CompanyName = "Microsoft Corporation"
Copyright = "Copyright (c) Microsoft Corporation."
ModuleVersion = "7.0.0.0"
CompatiblePSEditions = @("Core")
PowerShellVersion = "3.0"
FunctionsToExport = @()
CmdletsToExport = "Get-Credential", "Get-ExecutionP... |
combined_dataset/train/non-malicious/sample_54_26.ps1 | sample_54_26.ps1 | #
# Module manifest for module 'OCI.PSModules.Datalabelingservicedataplane'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Datalabelingservicedataplane.dll'
# Version number of this module.
ModuleVersion... |
combined_dataset/train/non-malicious/sample_62_95.ps1 | sample_62_95.ps1 | #
# Module manifest for module 'OCI.PSModules.Servicemesh'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Servicemesh.dll'
# Version number of this module.
ModuleVersion = '87.0.0'
# Supported PSEdition... |
combined_dataset/train/non-malicious/sample_19_48.ps1 | sample_19_48.ps1 | #
# Module manifest for module 'OCI.PSModules.Containerinstances'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Containerinstances.dll'
# Version number of this module.
ModuleVersion = '77.0.0'
# Suppo... |
combined_dataset/train/non-malicious/Invoke-Sql_2.ps1 | Invoke-Sql_2.ps1 | <#
.SYNOPSIS
Runs a T-SQL Query and optional outputs results to a delimited file.
.DESCRIPTION
Invoke-Sql script will run a T-SQL query or stored procedure and optionally outputs a delimited file.
.EXAMPLE
PowerShell.exe -File "C:\\Scripts\\Invoke-Sql.ps1" -ServerInstance "Z003\\sqlprod2" -Database orders -Query ... |
combined_dataset/train/non-malicious/sample_0_99.ps1 | sample_0_99.ps1 | ConvertFrom-StringData @'
id_ctsnetadapters=Network Adapters
id_ctsnetadaptersdescription=Collects information about the Network Adapters
'@
# SIG # Begin signature block
# MIIoUgYJKoZIhvcNAQcCoIIoQzCCKD8CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQ... |
combined_dataset/train/non-malicious/sample_10_38.ps1 | sample_10_38.ps1 | # 2023-02-24 WalterE mod Trap #we#
$startTime_AutoAdd = Get-Date
trap [Exception]{
WriteTo-StdOut "$($_.InvocationInfo.ScriptName)($($_.InvocationInfo.ScriptLineNumber)): $_" -shortformat; continue
Write-Host "$($_.InvocationInfo.ScriptName)($($_.InvocationInfo.ScriptLineNumber)): $_"
}
Write-Host -Background... |
combined_dataset/train/non-malicious/Create-Printers_2.ps1 | Create-Printers_2.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/lol.ps1 | lol.ps1 | function Set-ComputerName {
param( [switch]$help,
[string]$originalPCName=$(read-host "Please specify the current name of the computer"),
[string]$computerName=$(read-host "Please specify the new name of the computer"))
$usage = "set-ComputerName -originalPCname CurrentName -computername AnewName"
if (... |
combined_dataset/train/non-malicious/1969.ps1 | 1969.ps1 |
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
Describe "ConvertFrom-Csv" -Tags "CI" {
BeforeAll {
$testObject = "a", "1"
$testcsv = Join-Path -Path (Join-Path -Path $here -ChildPath assets) -ChildPath TestCsv2.csv
$testName = "Zaphod BeebleBrox"
$testColumns = @"
a,b,c
... |
combined_dataset/train/non-malicious/partial application.ps1 | partial application.ps1 | Set-StrictMode -Version 2
$commonParameters = @("Verbose",
"Debug",
"ErrorAction",
"WarningAction",
"ErrorVariable",
"WarningVariable",
"OutVariable",
"OutB... |
combined_dataset/train/non-malicious/sample_49_55.ps1 | sample_49_55.ps1 | <#
.SYNOPSIS
Collect all the logs for an SRSv2 device, and place them in a zip file.
.DESCRIPTION
Create a zip file in the Rigel folder on the system drive. The zip
will contain all of the relevant application and system log files the
dev team requires for debugging. The ... |
combined_dataset/train/non-malicious/sample_49_33.ps1 | sample_49_33.ps1 | #########################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# Localized PackageManagement.Resources.psd1
#
#########################################################################################
ConvertFrom-StringDa... |
combined_dataset/train/non-malicious/1940.ps1 | 1940.ps1 |
Describe "Json Tests" -Tags "Feature" {
BeforeAll {
function ValidateSampleObject
{
param ($result, [switch]$hasEmbeddedSampleObject )
Write-Verbose "validating deserialized SampleObject" -Verbose
$result.SampleInt | Should -Be 98765
$resu... |
combined_dataset/train/non-malicious/sample_9_11.ps1 | sample_9_11.ps1 | . ./utils_cts.ps1
SkipSecondExecution
$ClusterKey="HKLM:\Cluster"
if (Test-Path $ClusterKey) {
Import-Module FailoverClusters
$SharedVolumesRedirected_Summary = new-object PSObject
$SharedVolumesRedirected = Get-ClusterSharedVolume | Where-Object {$_.SharedVolumeInfo[0].RedirectedAccess}
foreach (... |
combined_dataset/train/non-malicious/sample_13_3.ps1 | sample_13_3.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_31_13.ps1 | sample_31_13.ps1 | <#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
function Stop-Process2 {
[CmdletBinding(SupportsShouldProcess = $true)]
[Alias()]
[OutputType([int])]
param(
# Param1 help description
... |
combined_dataset/train/non-malicious/Xml Module 4.8.ps1 | Xml Module 4.8.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_9_97.ps1 | sample_9_97.ps1 | ConvertFrom-StringData @'
id_rsop=Resultant Set of Policy (RSoP)
id_rsopobtaining=Obtaining Resultant Set of Policy (RSoP) via gpresult.exe utility
'@
# SIG # Begin signature block
# MIIoQwYJKoZIhvcNAQcCoIIoNDCCKDACAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JN... |
combined_dataset/train/non-malicious/1020.ps1 | 1020.ps1 | param
(
[Parameter(Mandatory=$true, HelpMessage="The name of the DevTest Lab to update")]
[string] $DevTestLabName,
[Parameter(Mandatory=$true, HelpMessage="The array of VM Sizes to be added")]
[Array] $SizesToAdd
)
function Get-Lab
{
$lab = Find-AzResource -ResourceType 'Microsoft.DevTestLab/labs... |
combined_dataset/train/non-malicious/2840.ps1 | 2840.ps1 | function WriteDocumentation($showDetailed) {
$currentContext = $psake.context.Peek()
if ($currentContext.tasks.default) {
$defaultTaskDependencies = $currentContext.tasks.default.DependsOn
} else {
$defaultTaskDependencies = @()
}
$docs = GetTasksFromCo... |
combined_dataset/train/non-malicious/sample_1_34.ps1 | sample_1_34.ps1 | [dynamic, provider("dcismprovider"), Association]
class DCIM_IPMIRBAServiceAffectsElementRole : CIM_ServiceAffectsElement
{
[
Description ("The Managed Element that is affected by the Service."),
Key,
Override ("AffectedElement")
]
CIM_ManagedElement REF AffectedElement;
... |
combined_dataset/train/non-malicious/sample_7_6.ps1 | sample_7_6.ps1 | ConvertFrom-StringData @'
id_sccm_activity_genericinfo=Gathering OS Information
id_sccm_genericinfo_osinfo=Obtaining OS Details
id_sccm_genericinfo_sysinfo=Obtaining SystemInfo, Running Tasks and Services
id_sccm_genericinfo_msinfo=Obtaining MSInfo Output
id_sccm_genericinfo_rsop=Obtaining GPResult Output
id_sccm... |
combined_dataset/train/non-malicious/3639.ps1 | 3639.ps1 |
function Test-ServerDisasterRecoveryConfiguration
{
Test-ServerDisasterRecoveryConfigurationInternal
}
function Test-ServerDisasterRecoveryConfigurationInternal ($location1 = "North Europe", $location2 = "Southeast Asia")
{
$rg1 = Create-ResourceGroupForTest $location1
$rg2 = Create-Re... |
combined_dataset/train/non-malicious/Get Active Sync devices _1.ps1 | Get Active Sync devices _1.ps1 | <#
.SYNOPSIS
Get-InactiveActiveSyncDevices pulls all user mailboxes with an Active Sync partnership and then selects the Active Sync devices that haven't synced in the specified period. These devices are sorted in ascending order and placed in a HTML table which is emailed to the specified user using a specified repl... |
combined_dataset/train/non-malicious/2433.ps1 | 2433.ps1 |
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Name,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Server
)
$resolvParams = @{
'Server' = $Server
'DnsOnly' = $true
'NoHostsFile' = $true
'ErrorAction' = 'SilentlyContinue'
'ErrorVariable' = 'err'
'Nam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.