full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
combined_dataset/train/non-malicious/sample_2_64.ps1 | sample_2_64.ps1 | #
# Module manifest for module 'OCI.PSModules.Osubsubscription'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Osubsubscription.dll'
# Version number of this module.
ModuleVersion = '92.1.0'
# Supported... |
combined_dataset/train/non-malicious/sample_28_28.ps1 | sample_28_28.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\typescript@5.3.3\node_modules\typescript\bin\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\typ... |
combined_dataset/train/non-malicious/sample_23_63.ps1 | sample_23_63.ps1 | # region Generated
# ----------------------------------------------------------------------------------
# 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 obt... |
combined_dataset/train/non-malicious/Update-AdminPassword.ps1 | Update-AdminPassword.ps1 | <#
.SYNOPSIS
Local administrator password update
.DESCRIPTION
This script changes the local administrator password.
.PARAMETER ADSPath
The ActiveDirectory namespace to search for computers
.PARAMETER AdminAccount
The username of the administrator account
.PAR... |
combined_dataset/train/non-malicious/3644.ps1 | 3644.ps1 |
function Handle-InstanceFailoverGroupTest($scriptBlock, $rg = "testclrg", $primaryLocation = "southeastasia", $secondaryLocation = "southeastasia", $mi1 = $null, $mi2 = $null, $cleanup = $false)
{
try
{
$rg = if ($rg -eq $null) { "testclrg" } else { $rg }
$miName1 = if ($mi1 -eq $null) { "tdstage-ha... |
combined_dataset/train/non-malicious/sample_40_55.ps1 | sample_40_55.ps1 |
///////////////////////////////////////////////////////////////////////////////
// Helper to set a designer prop
///////////////////////////////////////////////////////////////////////////////
function setDesignerProp(tname, ttype, tvalue) {
var trait = document.designerProps.getOrCreateTrait(tname, ttype, 0)... |
combined_dataset/train/non-malicious/4188.ps1 | 4188.ps1 |
Clear-Host
$Global:OS
Function GetOSArchitecture{
$Global:OS=Get-WMIObject win32_operatingsystem
$Global:OS.OSArchitecture
}
GetOSArchitecture
If($Global.OS.OSArchitecture -ne "32-bit"){
New-Item -Path "HKLM:\SOFTWARE\Wow6432Node\Adobe" -Name "Adobe ARM" –Force
... |
combined_dataset/train/non-malicious/235.ps1 | 235.ps1 | Function Expand-GZipFile
{
[CmdletBinding()]
Param(
[ValidateScript({Test-path -Path $_})]
[String]$LiteralPath,
$outfile = ($LiteralPath -replace '\.gz$','')
)
try{
$FileStreamIn = New-Object -TypeName System.IO.FileStream -ArgumentList $LiteralPath, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([I... |
combined_dataset/train/non-malicious/2710.ps1 | 2710.ps1 |
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[String]$FileHash,
[Parameter(Mandatory=$False,Position=2)]
[ValidateSet("MD5","SHA1","SHA256","SHA384","SHA512","RIPEMD160")]
[string]$HashType = "SHA256",
[Parameter(Mandatory=$False,Position=3)]
[String]$Ba... |
combined_dataset/train/non-malicious/chkhash_24.ps1 | chkhash_24.ps1 | # calculate SHA512 of file.
function Get-SHA512([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]'))
{
$stream = $null;
$cryptoServiceProvider = [System.Security.Cryptography.SHA512CryptoServiceProvider];
$hashAlgorithm = new-object $cryptoServiceProvider
$stream = $file.Open... |
combined_dataset/train/non-malicious/sample_6_47.ps1 | sample_6_47.ps1 | // Copyright (c) 2009 DMTF. All rights reserved.
[Version ( "2.22.0" ),
UMLPackagePath ( "CIM::Network::Misc" ),
Description (
"A subclass of EnabledLogicalElementCapabilities that defines "
"the capabilities of a ProtocolService. An instance of "
"CIM_ProtocolServiceCapabiliti... |
combined_dataset/train/non-malicious/sample_57_35.ps1 | sample_57_35.ps1 | # diag_uex.psm1
# Created by tdimli
# March 2020
#
# Diagnostic functions for UEX area
# version
$UEX_version = "1.0.231129.0"
# Area and Area/Component arrays
$UEX = @("xray_uex_wmi")
#Component/Diagnostic Function arrays
$xray_uex_wmi = @("uex_wmi_KB2020286")
# begin: diagnostic functions
#regio... |
combined_dataset/train/non-malicious/3708.ps1 | 3708.ps1 |
function Enable-AzAdvisorRecommendationByNameParameterSet
{
$RecommendationName = "4fa2ff4f-dc90-9876-0723-1360fa9f4bd7"
$queryResult = Enable-AzAdvisorRecommendation -RecommendationName $RecommendationName
Assert-IsInstance $queryResult Microsoft.Azure.Commands.Advisor.Cmdlets.Models.PsAzureAdvi... |
combined_dataset/train/non-malicious/3420.ps1 | 3420.ps1 |
function Test-RoleDefinitionCreateTests
{
$rdName = 'CustomRole Tests Role'
New-AzureRmRoleDefinition -InputFile NewRoleDefinition.json
$rd = Get-AzureRmRoleDefinition -Name $rdName
Assert-AreEqual "Test role" $rd.Description
Assert-AreEqual $true $rd.IsCustom
Assert-NotNull $rd.Act... |
combined_dataset/train/non-malicious/1620.ps1 | 1620.ps1 | function Logoff-User ($Name, $Server) {
if (!(gcm quser -ea 0)) {
throw 'could not find quser.exe'
}
$users = quser /server:$Server | select -Skip 1
if ($Name) {
$user = $users | ? {$_ -match $Name}
} else {
$user = $users | Out-Menu
}
$id = ($user.split() | ? ... |
combined_dataset/train/non-malicious/1397.ps1 | 1397.ps1 |
function Grant-CComPermission
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]
$Identity,
[Parameter(Mandatory=$true,ParameterSetName='DefaultAccessPermissionAllow')]
[Parameter(Mandatory=$true,ParameterSetName='MachineAccessRestrict... |
combined_dataset/train/non-malicious/Search-SPN.ps1 | Search-SPN.ps1 | <#
.SYNOPSIS
This function is used for finding all AD objects with a given SPN.
.DESCRIPTION
Finds all AD objects that have a given SPN. Wildcard search patterns are
acceptable.
.PARAMETER SearchRoot
The root path at which to search. Should be in the form of "LDAP://xyz".
.PARAMETER ... |
combined_dataset/train/non-malicious/4185.ps1 | 4185.ps1 |
$Global:RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent) + "\"
Function Wait-ProcessEnd {
Param ([String]$Process)
$Proc = Get-Process $Process -ErrorAction SilentlyContinue
If ($Proc -ne $null) {
Do {
Start-Sleep -Seconds 5
$Proc = Get-Process $Process -ErrorAction SilentlyCon... |
combined_dataset/train/non-malicious/3660.ps1 | 3660.ps1 |
function Test-ListDatabaseRestorePoints
{
$location = "Southeast Asia"
$serverVersion = "12.0";
$rg = Create-ResourceGroupForTest
try
{
$server = Create-ServerForTest $rg $location
$databaseName = Get-DatabaseName
$dwdb = New-AzSqlDatabase -ResourceGroupName $rg.ResourceGroupName -Serve... |
combined_dataset/train/non-malicious/sample_15_63.ps1 | sample_15_63.ps1 | #************************************************
# TS_VeritasVXIOBadConfigFlags.ps1
# Version 1.0.1
# Date: 5/16/2012
# Author: v-kaw
# Description: [Idea ID 3919] [Windows] Create Shadow Copy fail only on VERTIAS storage foundation volume
# Rule number: 3919
# Rule URL: //sharepoint/sites/rules/Rule%20Submi... |
combined_dataset/train/non-malicious/sample_53_91.ps1 | sample_53_91.ps1 | #
# Module manifest for module 'OCI.PSModules.Dts'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Dts.dll'
# Version number of this module.
ModuleVersion = '83.2.0'
# Supported PSEditions
CompatiblePSEd... |
combined_dataset/train/non-malicious/Deploy VM with Static IP.ps1 | Deploy VM with Static IP.ps1 | # 1. Create a simple customizations spec:
$custSpec = New-OSCustomizationSpec -Type NonPersistent -OSType Windows -OrgName “My Organization” -FullName “MyVM” -Domain “MyDomain” –DomainAdminUsername “user” –DomainAdminPassword “password”
# 2. Modify the default network customization settings:
$custSpec | Get-OSCustom... |
combined_dataset/train/non-malicious/1370.ps1 | 1370.ps1 |
function Install-CUser
{
[CmdletBinding(SupportsShouldProcess=$true,DefaultParameterSetName='WithUserNameAndPassword')]
[OutputType([System.DirectoryServices.AccountManagement.UserPrincipal])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams","")]
param(
... |
combined_dataset/train/non-malicious/sample_60_31.ps1 | sample_60_31.ps1 | # Localized ArchiveResources.psd1
ConvertFrom-StringData @'
###PSLOC
PathNotFoundError=The path '{0}' either does not exist or is not a valid file system path.
ExpandArchiveInValidDestinationPath=The path '{0}' is not a valid file system directory path.
InvalidZipFileExtensionError={0} is not a supported archive... |
combined_dataset/train/non-malicious/3989.ps1 | 3989.ps1 |
function ServiceBusQueueTests {
$location = Get-Location
$resourceGroupName = getAssetName "RGName-"
$namespaceName = getAssetName "Namespace-"
$nameQueue = getAssetName "Queue-"
Write-Debug "ResourceGroup name : $resourceGroupName"
New-AzResourceGroup -Name $resourceGro... |
combined_dataset/train/non-malicious/sample_1_5.ps1 | sample_1_5.ps1 | #************************************************
# TS_BPAInfo.ps1
# Version 1.5.6
# Date: 12-10-2010 / 2019 WalterE
# Author: Andre Teixeira - andret@microsoft.com
# Description: - This script is used to obtain a report from any inbox BPA Module information or other BPAs with MBCA support.
#*********************... |
combined_dataset/train/non-malicious/Import-UniqueModule.ps1 | Import-UniqueModule.ps1 | ## WARNING: I take no responsibility for how weird this is.
function Import-UniqueModule {
param([Parameter(Mandatory=$true)][String]$ModuleName)
$unique = [guid]::NewGuid().Guid -replace "-"
Import-Module $ModuleName -Prefix $unique
Get-Command -Module $ModuleName |
New-Alias -Name {$_.Name -replace $un... |
combined_dataset/train/non-malicious/sample_53_40.ps1 | sample_53_40.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function Import-EditorCommand {
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
[OutputType([Microsoft.PowerShell.EditorServices.Extensions.EditorCommand, Microsoft.PowerShell.EditorServices])]
[Cmdle... |
combined_dataset/train/non-malicious/sample_34_12.ps1 | sample_34_12.ps1 | #
# Script module for module 'Az.PostgreSql' that is executed when 'Az.PostgreSql' is imported in a PowerShell session.
#
# Generated by: Microsoft Corporation
#
# Generated on: 04/23/2024 13:01:42
#
$PSDefaultParameterValues.Clear()
Set-StrictMode -Version Latest
function Test-DotNet
{
try
{
... |
combined_dataset/train/non-malicious/1161.ps1 | 1161.ps1 |
$junctionName = $null
$junctionPath = $null
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot '..\Initialize-CarbonTest.ps1' -Resolve)
}
function Start-Test
{
$junctionName = [IO.Path]::GetRandomFilename()
$junctionPath = Join-Path $env:Temp $junctionName
New-Junction -Link... |
combined_dataset/train/non-malicious/Start-Encryption.ps1 | Start-Encryption.ps1 | ## Start-Encryption
##################################################################################################
## Rijndael symmetric key encryption ... with no passes on the key. Very lazy.
## USAGE:
## $encrypted = Encrypt-String "Oisin Grehan is a genius" "P@ssw0rd"
## Decrypt-String $encrypted "P@ssw0rd... |
combined_dataset/train/non-malicious/sample_41_29.ps1 | sample_41_29.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_32_34.ps1 | sample_32_34.ps1 | #
# Module manifest for module 'OCI.PSModules.Lockbox'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Lockbox.dll'
# Version number of this module.
ModuleVersion = '82.0.0'
# Supported PSEditions
Compat... |
combined_dataset/train/non-malicious/1813.ps1 | 1813.ps1 |
Describe "Get-PSDrive" -Tags "CI" {
It "Should not throw" {
Get-PSDrive | Should -Not -BeNullOrEmpty
}
It "Should have a name and a length property" {
(Get-PSDrive).Name | Should -Not -BeNullOrEmpty
(Get-PSDrive).Root.Length | Should -Not -BeLessThan 1
}
It "Should be able to be calle... |
combined_dataset/train/non-malicious/3249.ps1 | 3249.ps1 |
class ConfigProvidedParameter {
[PoshBot.FromConfig]$Metadata
[System.Management.Automation.ParameterMetadata]$Parameter
ConfigProvidedParameter([PoshBot.FromConfig]$Meta, [System.Management.Automation.ParameterMetadata]$Param) {
$this.Metadata = $Meta
$this.Parameter = $param
}
}
|
combined_dataset/train/non-malicious/sample_28_94.ps1 | sample_28_94.ps1 | param($installPath, $toolsPath, $package, $project)
Import-Module (Join-Path $toolsPath common.psm1) -Force
try {
# Indicates if the current project is a VB project
if ([string]::IsNullOrEmpty($project.CodeModel.Language)) {
$IsVbProject = $project.FullName -like "*.vbproj"
}
else {... |
combined_dataset/train/non-malicious/Ayth.ps1 | Ayth.ps1 | # ========================================================================
#
# Microsoft PowerShell Source File -- Created with PowerShell Plus Professional
#
# NAME: Disable-MassMailPF.ps1
#
# AUTHOR: Darrin Henshaw , Ignition IT Canada Ltd.
# DATE : 8/13/2008
#
# COMMENT: Used to disable mail on an impo... |
combined_dataset/train/non-malicious/sample_38_42.ps1 | sample_38_42.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 = '74.1.0'
# Suppo... |
combined_dataset/train/non-malicious/sample_52_64.ps1 | sample_52_64.ps1 | #
# Script module for module 'Az.DevTestLabs' that is executed when 'Az.DevTestLabs' is imported in a PowerShell session.
#
# Generated by: Microsoft Corporation
#
# Generated on: 05/16/2024 06:33:07
#
$PSDefaultParameterValues.Clear()
Set-StrictMode -Version Latest
function Test-DotNet
{
try
{
... |
combined_dataset/train/non-malicious/977.ps1 | 977.ps1 |
$subscriptionId = '<SubscriptionID>'
$randomIdentifier = $(Get-Random)
$resourceGroupName = "myResourceGroup-$randomIdentifier"
$location = "West US 2"
$adminLogin = "azureuser"
$password = "PWD27!"+(New-Guid).Guid
$serverName = "mysqlserver-$randomIdentifier"
$databaseName = "mySampleDatabase"
$drLocation = "East US ... |
combined_dataset/train/non-malicious/sample_3_13.ps1 | sample_3_13.ps1 | #
# Module manifest for module 'OCI.PSModules.Containerengine'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Containerengine.dll'
# Version number of this module.
ModuleVersion = '93.0.0'
# Supported P... |
combined_dataset/train/non-malicious/sample_14_13.ps1 | sample_14_13.ps1 | ConvertFrom-StringData @'
id_mats_networkadapter=Network Adapter
id_mats_networkadaptertype=Type
id_mats_networkadapterspeed=Speed
id_mats_ipaddresses=IP Addresses
id_mats_defaultgateway=Default Gateway
id_mats_dnsservers=DNS Servers
id_mats_proxyenabled=Proxy Server
id_enabled=Enabled
id_mats_proxyserveradd=P... |
combined_dataset/train/non-malicious/sample_16_90.ps1 | sample_16_90.ps1 | #
# Module manifest for module 'OCI.PSModules.Datasafe'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Datasafe.dll'
# Version number of this module.
ModuleVersion = '80.0.0'
# Supported PSEditions
Comp... |
combined_dataset/train/non-malicious/933.ps1 | 933.ps1 |
$apiVersion = "2015-04-08"
$resourceGroupName = "myResourceGroup"
$accountName = "mycosmosaccount"
$tableName = "table1"
$tableThroughputResourceType = "Microsoft.DocumentDb/databaseAccounts/apis/tables/settings"
$tableThroughputResourceName = $accountName + "/table/" + $tableName + "/throughput"
Get-AzResource -Re... |
combined_dataset/train/non-malicious/sample_25_87.ps1 | sample_25_87.ps1 | #
# Module manifest for module 'OCI.PSModules.Resourcesearch'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Resourcesearch.dll'
# Version number of this module.
ModuleVersion = '79.0.0'
# Supported PSE... |
combined_dataset/train/non-malicious/sample_21_95.ps1 | sample_21_95.ps1 | @{
RootModule = 'PSReadLine.psm1'
NestedModules = @("Microsoft.PowerShell.PSReadLine2.dll")
ModuleVersion = '2.4.0'
GUID = '5714753b-2afd-4492-a5fd-01d9e2cff8b5'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = '(c) Microsoft Corporation. All rights reserved.'
Description = 'Gr... |
combined_dataset/train/non-malicious/Get_Set Signature _3.0.ps1 | Get_Set Signature _3.0.ps1 | #Requires -version 2.0
## Authenticode.psm1 updated for PowerShell 2.0 (with time stamping)
####################################################################################################
## Wrappers for the Get-AuthenticodeSignature and Set-AuthenticodeSignature cmdlets
## These properly parse paths, so they... |
combined_dataset/train/non-malicious/1570.ps1 | 1570.ps1 |
function Get-MrDayLightSavingTime {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline)]
[ValidateRange(2007,9999)]
[Int[]]$Year = (Get-Date).Year
)
PROCESS {
foreach ($y in $Year) {
[datetime]$beginDate = "March 1, $y"
while ($b... |
combined_dataset/train/non-malicious/vSphere Resultant Privs.ps1 | vSphere Resultant Privs.ps1 | # Need the Quest ActiveRoles cmdlets for this one.
Add-PSSnapin Quest.ActiveRoles* -ea SilentlyContinue
function Get-Groups {
param($principal)
# Start with this principal's base set of groups.
Write-Verbose "Checking principal $principal"
$groups = Get-QADUser $principal | Get-QADMemberOf
# Groups ca... |
combined_dataset/train/non-malicious/3726.ps1 | 3726.ps1 |
function Test-SmartGroupChangeState
{
$smartGroups = Get-AzSmartGroup -TimeRange 1h
$smartGroupId = $smartGroups[0].Id
$oldSmartGroup = Get-AzSmartGroup -SmartGroupId $smartGroupId
$newState = "Acknowledged"
$updatedSmartGroup = Update-AzSmartGroupState -SmartGroupId $smartGroupId -State $newStat... |
combined_dataset/train/non-malicious/2408.ps1 | 2408.ps1 |
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateScript({ Test-Connection -ComputerName $_ -Quiet -Count 1 })]
[string]$DestinationComputername,
[string[]]$ExcludePaths,
[string[]]$ExcludeTasks,
[switch]$SkipDisabledTasks
)
function Get-MyScheduledTask ($Computername) {
$ScriptBlock = {
$Service = N... |
combined_dataset/train/non-malicious/Get-PipeLineObject_2.ps1 | Get-PipeLineObject_2.ps1 | # For TabExpansion.ps1
# this requires latest TabExpansion.ps1 in a same directory
function Get-PipeLineObject {
$i = -2
$property = $null
do {
$str = $line.Split("|")
# extract the command name from the string
# first split the string into statements and pipeline elements
... |
combined_dataset/train/non-malicious/3557.ps1 | 3557.ps1 |
$suffix="v2avm1"
$JobQueryWaitTimeInSeconds = 0
$PrimaryFabricName = "V2A-W2K12-400"
$PrimaryNetworkFriendlyName = "corp"
$RecoveryNetworkFriendlyName = "corp"
$NetworkMappingName = "corp96map"
$RecoveryPlanName = "RPSwag96" + $suffix
$policyName1 = "V2aTest" + $suffix
$policyName2 = "V2aTest"+ $suffix... |
combined_dataset/train/non-malicious/4419.ps1 | 4419.ps1 | function Save-Module {
[CmdletBinding(DefaultParameterSetName = 'NameAndPathParameterSet',
HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=531351',
SupportsShouldProcess = $true)]
Param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true,
... |
combined_dataset/train/non-malicious/2900.ps1 | 2900.ps1 | Properties {
[string]$testProperty = "Test123"
}
BuildSetup {
[string]$expected = "Test123"
if ($testProperty -ne $expected) {
throw "Expected sequence '$expected', but was actually '$testProperty'"
}
}
Task default -depends Compile, Test, Deploy
Task Compile {
"Compiling"
}
Task Test -d... |
combined_dataset/train/non-malicious/2651.ps1 | 2651.ps1 | $alerts = (Get-Content C:\Users\Mike\Documents\UpSearch\Alerts.json) -join "`n" | ConvertFrom-Json
$sql = @()
foreach($alert in $alerts){
$sql += @"
EXEC msdb.dbo.sp_add_alert @name=N'$($alert.Name)',
@message_id=$($alert.MessageID),
@severity=$($alert.Severity),
@enabled=1,
@delay_between_responses=60,
... |
combined_dataset/train/non-malicious/VM Last Poweron Time.ps1 | VM Last Poweron Time.ps1 | # Get a VM's last power on date based on the VM's events.
# Requires PowerCLI 4.0 and PowerShell v2.
function Get-LastPowerOn {
param(
[Parameter(
Mandatory=$true,
ValueFromPipeline=$true,
HelpMessage="VM"
)]
[VMware.VimAutomation.Types.VirtualMachin... |
combined_dataset/train/non-malicious/Poczta.ps1 | Poczta.ps1 | param(
[switch]$Help
, [string] $User
, [string] $Password
, [string[]] $ComputerNames = @()
)
$usage = @'
Get-OUComputerNames
usage : [computerName1,computerName2,... | ] ./Set-LocalPassword.ps1 [-user] <userName> [-password] <password> [[-computers] computerName1,computerName2,...]
returns : Sets lo... |
combined_dataset/train/non-malicious/sample_53_15.ps1 | sample_53_15.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_33_6.ps1 | sample_33_6.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\typescript@5.3.3\node_modules\typescript\bin\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\typ... |
combined_dataset/train/non-malicious/484.ps1 | 484.ps1 |
function Remove-HostFileEntry{
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[String]
$IP,
[Parameter(Mandatory=$false)]
[String]
$DNS
)
$HostFile = "$env:windir\System32\drivers\etc\hosts"
get-content $HostFile | %{
if($_.StartsWith("
... |
combined_dataset/train/non-malicious/sample_20_11.ps1 | sample_20_11.ps1 | # ------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
# ------------------------------------------------------------
param (
[Parameter(Manda... |
combined_dataset/train/non-malicious/sample_46_84.ps1 | sample_46_84.ps1 | Get-Module | ForEach-Object { Remove-Module -Name $_.Name -Force }
$PSModuleAutoloadingPreference = 'none'
Import-Module Microsoft.PowerShell.Utility
#Enforcing default PSModulePath to avoid getting unexpected modules to run instead of built-in modules
$env:PSModulePath = "C:\Program Files\WindowsPowerShell\Modules... |
combined_dataset/train/non-malicious/Select-FilteredObject.ps.ps1 | Select-FilteredObject.ps.ps1 | ##############################################################################\n##\n## Select-FilteredObject\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\nPr... |
combined_dataset/train/non-malicious/sample_63_40.ps1 | sample_63_40.ps1 | #
# Module manifest for module 'OCI.PSModules.Operatoraccesscontrol'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Operatoraccesscontrol.dll'
# Version number of this module.
ModuleVersion = '85.2.0'
#... |
combined_dataset/train/non-malicious/2717.ps1 | 2717.ps1 |
foreach($userpath in (Get-WmiObject win32_userprofile | Select-Object -ExpandProperty localpath)) {
if (Test-Path(($userpath + "\AppData\Local\Temp\"))) {
Get-ChildItem -Force ($userpath + "\AppData\Local\Temp\*") | Select-Object FullName, CreationTimeUtc, LastAccessTimeUtc, LastWriteTimeUtc
}
} |
combined_dataset/train/non-malicious/sample_3_7.ps1 | sample_3_7.ps1 |
// Copyright (c) 2010 Dell Inc. All rights reserved.
// ==================================================================
// DCIM_RAIDRegisteredProfile
// ==================================================================
[dynamic, provider("dcismprovider")]
class DCIM_RAIDRegisteredProfile : CIM_RegisteredPro... |
combined_dataset/train/non-malicious/741.ps1 | 741.ps1 |
function Write-RsFolderContent
{
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')]
param(
[switch]
$Recurse,
[Parameter(Mandatory = $True)]
[string]
$Path,
[Alias('DestinationFolder')]
[Parameter(Mandatory = $True)]
... |
combined_dataset/train/non-malicious/220.ps1 | 220.ps1 |
[CmdletBinding()]
PARAM (
[Parameter(Mandatory = $true, HelpMessage = "You must specify the Sender Email Address")]
[ValidatePattern("[a-z0-9!
[String]$EmailFrom,
[Parameter(Mandatory = $true, HelpMessage = "You must specify the Destination Email Address")]
[ValidatePattern("[a-z0-9!
[Strin... |
combined_dataset/train/non-malicious/sample_59_84.ps1 | sample_59_84.ps1 | <###################################################
# #
# Copyright (c) Microsoft. All rights reserved. #
# #
##################################################>
$ScratchDiskTemplateName = 'D:\UpdateScratchDisk... |
combined_dataset/train/non-malicious/Decode Psi IM passwords.ps1 | Decode Psi IM passwords.ps1 | function decrypt-psi ($jid, $pw) {
$OFS = ""; $u = 0;
for($p=0;$p -lt $pw.Length;$p+=4) {
[char]([int]"0x$($pw[$p..$($p+3)])" -bxor [int]$jid[$u++])
}
}
$accounts = ([xml](cat ~\\psidata\\profiles\\default\\accounts.xml))["accounts"]["accounts"]
foreach($account in ($accounts | gm a[0-9]*)) {
... |
combined_dataset/train/non-malicious/New-SelfRestartingTask.ps1 | New-SelfRestartingTask.ps1 | function New-SelfRestartingTask {
#.Notes
# For production use you should consider investigating more specific matching in the Query clause.
#
# There are many possibilities here: you could watch for instances of a process with specific command-line parameters, or a certain caption, etc. Or, you could match again... |
combined_dataset/train/non-malicious/sample_37_58.ps1 | sample_37_58.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 = '80.0.0'
# Supported PSEditions
CompatiblePS... |
combined_dataset/train/non-malicious/sample_51_84.ps1 | sample_51_84.ps1 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function Test-ScriptExtent {
<#
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
#>
[OutputType([bool], ParameterSetName='__AllParameterSets')]
[OutputType([System.Management.Automation.Language.IScriptExten... |
combined_dataset/train/non-malicious/3373.ps1 | 3373.ps1 |
[CmdletBinding()]
Param(
[Parameter(Mandatory = $True, Position = 0)]
[string]$ReleaseDate,
[Parameter(Mandatory = $True, Position = 1)]
[string]$ReleaseVersion,
[Parameter(Mandatory = $False, Position = 2)]
[string]$PathToRepo
)
function UpdateServiceChangeLog([string]$PathToChangeLog, [st... |
combined_dataset/train/non-malicious/sample_56_73.ps1 | sample_56_73.ps1 | #
# Module manifest for module 'OCI.PSModules.Psql'
#
# Generated by: Oracle Cloud Infrastructure
#
#
@{
# Script module or binary module file associated with this manifest.
RootModule = 'assemblies/OCI.PSModules.Psql.dll'
# Version number of this module.
ModuleVersion = '82.0.0'
# Supported PSEditions
CompatiblePS... |
combined_dataset/train/non-malicious/sample_65_44.ps1 | sample_65_44.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/TheMathFunction.ps1 | TheMathFunction.ps1 | Add-Type -Path (Join-Path (Split-Path $Profile) Libraries\\LoreSoft.MathExpressions.dll)
## You can dot-source this in 1.0 after uncommenting the following line, and deleting the first and last lines.
# [Reflection.Assembly]::LoadFrom((Join-Path (Split-Path $Profile) Libraries\\LoreSoft.MathExpressions.dll)) | Out-Nu... |
combined_dataset/train/non-malicious/141.ps1 | 141.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_64_80.ps1 | sample_64_80.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 = '83.3.0'
# Supported PSEditions
CompatiblePSEd... |
combined_dataset/train/non-malicious/sample_42_15.ps1 | sample_42_15.ps1 | <#
.SYNOPSIS
Creates and throws an invalid argument exception.
.PARAMETER Message
The message explaining why this error is being thrown.
.PARAMETER ArgumentName
The name of the invalid argument that is causing this error to be thrown.
#>
function New-InvalidArgumentExcept... |
combined_dataset/train/non-malicious/1686.ps1 | 1686.ps1 |
function Store-Creds ($pwfile = "c:\temp\$env:USERNAME.txt") {
$Credential = Get-Credential -Credential $env:USERNAME
$Credential.Password | ConvertFrom-SecureString | Set-Content $pwfile
}
function Get-Creds ($User = $env:USERNAME, $pwfile = "c:\temp\$env:USERNAME.txt") {
if (Test-Path $pwfile) {
... |
combined_dataset/train/non-malicious/2740.ps1 | 2740.ps1 |
[CmdletBinding()]
Param(
[Parameter(Mandatory=$False,Position=0)]
[String]$ScanPath="C:\Windows\System32"
)
Function Expand-Zip ($zipfile, $destination) {
[int32]$copyOption = 16
$shell = New-Object -ComObject shell.application
$zip = $shell.Namespace($zipfile)
foreach($item in $zip.items()... |
combined_dataset/train/non-malicious/sample_41_9.ps1 | sample_41_9.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 = '83.2.0'
# Supported PSEdition... |
combined_dataset/train/non-malicious/sample_53_17.ps1 | sample_53_17.ps1 | export function scrollToPrevious(horizontalScrollElement) {
horizontalScrollElement.scrollToPrevious();
}
export function scrollToNext(horizontalScrollElement) {
horizontalScrollElement.scrollToNext();
}
export function scrollInView(horizontalScrollElement, viewIndex) {
horizontalScrollElement.sc... |
combined_dataset/train/non-malicious/2398.ps1 | 2398.ps1 | function Import-Certificate
{
[CmdletBinding()]
param
(
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$ComputerName = $env:COMPUTERNAME,
[Parameter()]
[ValidateNotNullOrEmpty()]
[pscredential]$Credential,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[ValidateSet('CurrentUser', 'Loca... |
combined_dataset/train/non-malicious/2338.ps1 | 2338.ps1 |
[CmdletBinding(SupportsShouldProcess)]
[OutputType('System.Management.Automation.PSCustomObject')]
param (
[Parameter(Mandatory)]
[string[]]$Group,
[Parameter()]
[ValidatePattern('\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b')]
[string]$Email = 'admin@lab.local',
[Parameter()]
[string]$... |
combined_dataset/train/non-malicious/2114.ps1 | 2114.ps1 |
Describe "Tests conversion of deserialized types to original type using object properties." -Tags "CI" {
BeforeAll {
$type1,$type2,$type3,$type4 = Add-Type -PassThru -TypeDefinition @'
public class test1
{
public string name;
public int port;
pu... |
combined_dataset/train/non-malicious/sample_61_19.ps1 | sample_61_19.ps1 | # ------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
# ------------------------------------------------------------
param (
[Parameter(Manda... |
combined_dataset/train/non-malicious/Home Directory Perms.ps1 | Home Directory Perms.ps1 |
$FolderPath = "\\\\site filer\\userdata$\\"
$rootfolder = Get-ChildItem -Path $FolderPath -recurse
foreach ($file in $rootfolder) {
$file.FullName
Get-Acl $file.FullName | Format-List
$acl = Get-Acl $file.FullName
$acl.Access | %{$acl.RemoveAccessRule($_)}
#... |
combined_dataset/train/non-malicious/sample_31_32.ps1 | sample_31_32.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\resolve@1.22.8\node_modules\resolve\bin\node_modules;C:\Users\abder\component-maker\web\node_modules\.pnpm\resolve@... |
combined_dataset/train/non-malicious/sample_22_61.ps1 | sample_22_61.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 = '81.0.0'
# Suppo... |
combined_dataset/train/non-malicious/sample_42_25.ps1 | sample_42_25.ps1 | Import-LocalizedData -BindingVariable lcAdTxt -FileName AzStackHci.ExternalActiveDirectory.Strings.psd1
function Get-ParamFromCommandLineOrConfigFile {
[CmdletBinding()]
param (
[Parameter(Mandatory=$false)]
[string]
$ConfigurationJsonPath,
[Parameter(Mandatory=$true)]... |
combined_dataset/train/non-malicious/Publish Friendfeed Entry.ps1 | Publish Friendfeed Entry.ps1 | #Publish FF Entry using PowerShell script
#Description: PowerShell script to publish an entry to Friendfeed.
#Change the FF Username and Remotekey in the script.
#More info on the FF Api: http://friendfeed.com/api/
#Change the FF Username and Remotekey in the script.
#Author: Stefan Stranger
#Website: http://tiny... |
combined_dataset/train/non-malicious/Shift Operators_1.ps1 | Shift Operators_1.ps1 | #requires -version 2.0
Add-Type @"
public class Shift {
public static int Left(int x, int count) { return x >> count; }
public static uint Left(uint x, int count) { return x >> count; }
public static long Left(long x, int count) { return x >> count; }
public static ulong Left(ulong x, int ... |
combined_dataset/train/non-malicious/sample_10_12.ps1 | sample_10_12.ps1 | #************************************************
# Function.ps1
# Version 1.0.0
# Date: 03-01-2012
# Author: Wilson Souza - wsouza@microsoft.com
# Description: This script contains functions used by others ps1 files
#************************************************
Import-LocalizedData -BindingVariable ScriptSt... |
combined_dataset/train/non-malicious/sample_30_94.ps1 | sample_30_94.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 = '74.1.0'
# Supported PSEditions
... |
combined_dataset/train/non-malicious/sample_5_79.ps1 | sample_5_79.ps1 | <# Script name: tss_WorkFoldersDiag.ps1
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# THIS SAMPLE CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FO... |
combined_dataset/train/non-malicious/877.ps1 | 877.ps1 | function Start-MapReduce {
$ErrorActionPreference = "Stop"
$context = Get-AzContext
if ($context -eq $null)
{
Connect-AzAccount
}
$context
$clusterName = Read-Host -Prompt "Enter the HDInsight cluster name"
$creds=Get-Credential -Message "Enter the login for... |
combined_dataset/train/non-malicious/LibraryMSCS.ps1 | LibraryMSCS.ps1 | # ------------------------------------------------------------------------
### <Script>
### <Author>
### Chad Miller
### </Author>
### <Description>
### Defines functions for working with Microsoft Cluster Service (MSCS)
### </Description>
### <Usage>
### . ./LibraryMSCS.ps1
### </Usage>
### </Script>
# --... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.