full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/sample_10_13.ps1
sample_10_13.ps1
########################################################################### # DC_Disk_Quota # Version 1.0 # Date: 09-26-2012 # Author: mifannin # Description: Collects Disk Quota Data ########################################################################### Import-LocalizedData -BindingVariable Quota -FileNa...
combined_dataset/train/non-malicious/sample_23_28.ps1
sample_23_28.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.apach...
combined_dataset/train/non-malicious/sample_19_23.ps1
sample_19_23.ps1
#************************************************ # DC_DSRegEntries.ps1 # Version 1.1 # Date: 2009-2019, 2022-10-14 # Author: + Walter Eder (waltere@microsoft.com) # Description: Collects Directory Services Registry Entries # Called from: TS_AutoAddCommands_DOM.ps1, TS_AutoAddCommands_NET.ps1 #******************...
combined_dataset/train/non-malicious/sample_48_91.ps1
sample_48_91.ps1
export function setControlAttribute(id, attrName, value) { const fieldElement = document.querySelector("#" + id)?.shadowRoot?.querySelector(".selected-value"); if (!!fieldElement) { fieldElement?.setAttribute(attrName, value); } } // SIG // Begin signature block // SIG // MIIoJwYJKoZIhvcN...
combined_dataset/train/non-malicious/sample_16_38.ps1
sample_16_38.ps1
# # Module manifest for module 'OCI.PSModules.Bastion' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Bastion.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported PSEditions Compat...
combined_dataset/train/non-malicious/sample_27_98.ps1
sample_27_98.ps1
#Requires -RunAsAdministrator ##------------------------------------------------------------------ ## <copyright file="Install-ObservabilityExtension.ps1" company="Microsoft"> ## Copyright (C) Microsoft. All rights reserved. ## </copyright> ##-----------------------------------------------------------------...
combined_dataset/train/non-malicious/4200.ps1
4200.ps1
Set-Variable -Name Errors -Value $null -Scope Global -Force Set-Variable -Name LogFile -Value "c:\windows\waller\Logs\BuildLogs\AdobeFlashPlayer.log" -Scope Global -Force Set-Variable -Name RelativePath -Scope Global -Force Function ConsoleTitle ($Title){ $host.ui.RawUI.WindowTitle = $Title } Function GetRelative...
combined_dataset/train/non-malicious/sample_57_69.ps1
sample_57_69.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 = '86.0.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/Add CounterPaths 2 Mongo.ps1
Add CounterPaths 2 Mongo.ps1
<# .NOTES AUTHOR: Sunny Chakraborty(sunnyc7@gmail.com) WEBSITE: http://tekout.wordpress.com CREATED: 8/20/2012 Requires: a) PowerShell v2 or better b) Requires Mongo Official C# driver https://github.com/mongodb/mongo-csharp-driver/downloads Tested using 1.5.0.X .DESCRIPTION Similar in vein to Add-Event...
combined_dataset/train/non-malicious/sample_14_5.ps1
sample_14_5.ps1
# region Generated # Load the private module dll $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Kusto.private.dll') # Get the private module's instance $instance = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Module]::Instance # Export nothing to clear implicit exports Exp...
combined_dataset/train/non-malicious/sample_67_89.ps1
sample_67_89.ps1
# Queries EDP WNFs to get current configuration state. # param($scriptOutputPath, $scriptmode) $logpath = $scriptOutputPath + "\\" + $scriptmode + "EdpState.log" Add-Content -Path $logpath -Value ($scriptmode + ": Log EDP config info") # WNF (and other) p/invoke types. Add-Type -Path ($PSScriptRoot + "\\edput...
combined_dataset/train/non-malicious/sample_38_15.ps1
sample_38_15.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/chkhash_32.ps1
chkhash_32.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/1426.ps1
1426.ps1
function Get-CPrincipal { [CmdletBinding()] param( [Parameter(Mandatory)] [DirectoryServices.AccountManagement.Principal]$Principal, [Parameter(Mandatory)] [scriptblock]$Filter ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet $PSCmdlet ...
combined_dataset/train/non-malicious/Add-SVNFile.ps1
Add-SVNFile.ps1
None
combined_dataset/train/non-malicious/sample_50_62.ps1
sample_50_62.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_9_28.ps1
sample_9_28.ps1
#************************************************ # DC_RDSSH.ps1 # Version 1.0.1 # Date: 21-01-2012 # Author: Daniel Grund - dgrund@microsoft.com # Description: # This script gets the RDSSH config and # checks vital signs to inform user. # 1.0.0 Beta release #************************************************...
combined_dataset/train/non-malicious/Invoke-SqlCmdExe.ps1
Invoke-SqlCmdExe.ps1
<# .SYNOPSIS Runs a T-SQL Query and optional outputs results to a file. .DESCRIPTION Invoke-SqlCmdExes.ps1 script is a wrapper around sqlcmd.exe to run a T-SQL query or stored procedure and optionally outputs to a file. .EXAMPLE PowerShell.exe -File "C:\\Scripts\\Invoke-SqlCmdExe.ps1" -ServerInstance "Z001\\sql1"...
combined_dataset/train/non-malicious/1436.ps1
1436.ps1
function Get-CPowerShellModuleInstallPath { [CmdletBinding()] [OutputType([string])] param( ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState $modulePaths = $env:PSModulePath -split ';' $programFileModulePath = Joi...
combined_dataset/train/non-malicious/sample_66_14.ps1
sample_66_14.ps1
@{ GUID="eb74e8da-9ae2-482a-a648-e96550fb8733" Author="Microsoft Corporation" CompanyName="Microsoft Corporation" Copyright="© Microsoft Corporation. All rights reserved." Description='PowerShell module for working with ZIP archives.' ModuleVersion="1.2.5" PowerShellVersion="3.0" FunctionsToExport = @('Compress...
combined_dataset/train/non-malicious/2593.ps1
2593.ps1
$ReplItemsQuery = "DECLARE @ReplItems TABLE ( [ServerName] [varchar](64) NOT NULL, [Databasename] [varchar](128) NOT NULL, [addl_loan_data] [int] NULL, [appraisal] [int] NULL, [borrower] [int] NULL, [br_address] [int] NULL, [br_expense] [int] NULL, [br_income] [int] NULL, [br_liability] [int] NULL, [br...
combined_dataset/train/non-malicious/sample_67_78.ps1
sample_67_78.ps1
#!/usr/bin/env pwsh $PlaywrightFileName = Join-Path $PSScriptRoot "Microsoft.Playwright.dll" [Reflection.Assembly]::LoadFile($PlaywrightFileName) | Out-Null exit [Microsoft.Playwright.Program]::Main($args) # SIG # Begin signature block # MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3Ag...
combined_dataset/train/non-malicious/Remove-DeadITunesTracks.ps1
Remove-DeadITunesTracks.ps1
Clear $ITunes = New-Object -ComObject iTunes.Application 1..$ITunes.LibraryPlaylist.Tracks.Count | % { $CurrentTrack = $ITunes.LibraryPlaylist.Tracks.Item($_) # File Track ?? if ( $CurrentTrack.Kind -eq 1 ) { if ( ! ([System.IO.File]::Exists($CurrentTrack.Location)) ) { Write-Host "$($Current...
combined_dataset/train/non-malicious/sample_31_27.ps1
sample_31_27.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 = '77.0.0' # Supported P...
combined_dataset/train/non-malicious/sample_35_5.ps1
sample_35_5.ps1
# # Module manifest for module 'PSScriptAnalyzer' # @{ # Author of this module Author = 'Microsoft Corporation' # Script module or binary module file associated with this manifest. RootModule = 'PSScriptAnalyzer.psm1' # Version number of this module. ModuleVersion = '1.22.0' # ID used to uniquely identify this mod...
combined_dataset/train/non-malicious/sample_12_31.ps1
sample_12_31.ps1
ConvertFrom-StringData @' id_ex_exbpacmdact=Exchange Support Tool - ExBPA id_ex_exbpacmdstat=Running Exchange Best Practices Analyzer (ExBPA), please wait... id_ex_exbpacmdfiledescription=ExBPA Health Check id_ex_exbpacmdreportsection=Exchange Toolbox '@ # SIG # Begin signature block # MIIoUgYJKoZIhvcNAQcCoIIo...
combined_dataset/train/non-malicious/4124.ps1
4124.ps1
cls Set-Variable -Name a -Scope Global -Force Set-Variable -Name Output -Scope Global -Force Function AddRemovePrograms($KeyName, $DisplayName, $Version){ New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT Set-Variable -Name AddRemKey -Scope Local -Forc...
combined_dataset/train/non-malicious/sample_50_63.ps1
sample_50_63.ps1
##------------------------------------------------------------------ ## <copyright file="ExtensionHelper.psm1" company="Microsoft"> ## Copyright (C) Microsoft. All rights reserved. ## </copyright> ##------------------------------------------------------------------ #region Constants $global:systemDriveLett...
combined_dataset/train/non-malicious/2642.ps1
2642.ps1
param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $ServerList, [Parameter(Mandatory=$false)] [string] $OutputPath=([Environment]::GetFolderPath("MyDocuments"))) if((Test-Path $OutputPath) -eq $false) { throw "Invalid -OutputPath, please use a valid file path" } if(Test-Path $ServerLi...
combined_dataset/train/non-malicious/sample_34_64.ps1
sample_34_64.ps1
# # Module manifest for module 'OCI.PSModules.Queue' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Queue.dll' # Version number of this module. ModuleVersion = '73.1.0' # Supported PSEditions Compatible...
combined_dataset/train/non-malicious/1571.ps1
1571.ps1
function Get-MrAutoService { [CmdletBinding()] param ( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [string[]]$ComputerName, [System.Management.Automation.Credential()]$Credential = [System.Mana...
combined_dataset/train/non-malicious/sample_37_44.ps1
sample_37_44.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/3222.ps1
3222.ps1
describe 'New-PoshBotTextResponse' { it 'Returns a [PoshBot.Text.Response] object' { $resp = New-PoshBotTextResponse -Text 'abc' $resp.PSObject.TypeNames[0] | should be 'PoshBot.Text.Response' } it 'Has a valid [Text] field' { $resp = New-PoshBotTextResponse -Text 'abc' $re...
combined_dataset/train/non-malicious/Work-in-progressSPdeploy.ps1
Work-in-progressSPdeploy.ps1
[System.Reflection.Assembly]::Load('Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') | out-null [System.Reflection.Assembly]::Load('Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c') | out-null $msbuild = [Microsoft.Build.U...
combined_dataset/train/non-malicious/1077.ps1
1077.ps1
function Start-TestFixture { & (Join-Path -Path $PSScriptRoot '..\Initialize-CarbonTest.ps1' -Resolve) } function Test-ShouldDetectIfOSIs64Bit { $is64Bit = (Test-Path env:"ProgramFiles(x86)") Assert-Equal $is64Bit (Test-OSIs64Bit) }
combined_dataset/train/non-malicious/Twitter Module v0.2.1b.ps1
Twitter Module v0.2.1b.ps1
<# <# Name: Social Media Scripting Framework Module: Twitter Version: 0.2 BETA Date: 2013/02/03 Author: Carlos Veira Lorenzo RoughRevision: chriskenis e-mail: cveira [at] thinkinbig [dot] org blog: thinkinbig.org twitter: @cveira facebook: www.facebook.com/cveira Google+: gplus.to/cveira LinkedIn: es.linke...
combined_dataset/train/non-malicious/3501.ps1
3501.ps1
function Test-NewAzureRmSearchService { $rgname = getAssetName $loc = Get-Location -providerNamespace "Microsoft.Search" -resourceType "searchServices" -preferredLocation "West US" $svcName = $rgname + "-service" $sku = "Standard" $partitionCount = 1 $replicaCount = 1 $hostingMode = "Default" ...
combined_dataset/train/non-malicious/Read-HostWithPrompt_1.ps1
Read-HostWithPrompt_1.ps1
############################################################################# ## ## Read-HostWithPrompt ## ## From Windows PowerShell Cookbook (O'Reilly) ## by Lee Holmes (http://www.leeholmes.com/guide) ## ############################################################################## <# .SYNOPSIS Read ...
combined_dataset/train/non-malicious/2283.ps1
2283.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$false, HelpMessage="Site server where the SMS Provider is installed")] [string]$SiteServer = "CAS01", [parameter(Mandatory=$false, HelpMessage="ResourceID of the device")] [string]$ResourceID = "16777224" ) Begin { try { ...
combined_dataset/train/non-malicious/ConvertFrom-Property_1.ps1
ConvertFrom-Property_1.ps1
<# .SYNOPSIS Converts data from flat or single-level property files into PSObjects .DESCRIPTION Converts delimited string data into objects .PARAMETER PropertyText The text to be parsed .PARAMETER Separator The value separator string used between name=value pairs. Allows regular expressions. Def...
combined_dataset/train/non-malicious/721.ps1
721.ps1
function New-RsSubscription { [cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium', DefaultParameterSetName='FileShare')] param( [string] $ReportServerUri, [System.Management.Automation.PSCredential] $Credential, $Proxy, [Alias('R...
combined_dataset/train/non-malicious/mklink.ps1
mklink.ps1
using System; using System.Text; using System.IO; using System.Runtime.InteropServices; namespace mklink { class mklink { [DllImport("kernel32.dll")] static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int dwFlags); static void Main(st...
combined_dataset/train/non-malicious/sample_52_78.ps1
sample_52_78.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/2921.ps1
2921.ps1
task default -depends test task test { Push-Location 'legacy_and_default_build_file' $result = invoke-psake -Docs | Out-String -Width 120 Pop-Location Assert ($result -match 'adefaulttask') 'Default build file should a task called adefaulttask' }
combined_dataset/train/non-malicious/Prompt _for ISE_.ps1
Prompt _for ISE_.ps1
# just to know which file is invoked by my profile write-host "loaded . $($MyInvocation.MyCommand.Path)" if(!$global:WindowTitlePrefix) { # But if you're running "elevated" on vista, we want to show that ... if( ([System.Environment]::OSVersion.Version.Major -gt 5) -and ( # Vista and ... new-objec...
combined_dataset/train/non-malicious/Get-ComputerSession.ps1
Get-ComputerSession.ps1
Function Get-ComputerSession { <# .SYNOPSIS Retrieves all user sessions from local or remote server/s .DESCRIPTION Retrieves all user sessions from local or remote server/s. Requires query.exe in order to run properly. .PARAMETER computer Name of computer/s to run session query against. ...
combined_dataset/train/non-malicious/2243.ps1
2243.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [ValidateSet("Save","Revert")] [string]$Mode ) Begin { try { $TSEnvironment = New-Object -ComObject Microsoft.SMS.TSEnvironment -ErrorAction Stop } catch [System.Excepti...
combined_dataset/train/non-malicious/2418.ps1
2418.ps1
Function Get-SccmClientLog ($ComputerName,$LogName) { try { Write-Debug "Initiating the $($MyInvocation.MyCommand.Name) function..."; $output_properties = @{'ComputerName'=$ComputerName;'Log'=$LogName} if ($LogName -ne 'setup') { $sPath = "\\$ComputerName\admin$\ccmlogs"; $aLogData = @(); $aDir =...
combined_dataset/train/non-malicious/2845.ps1
2845.ps1
function CleanupEnvironment { if ($psake.context.Count -gt 0) { $currentContext = $psake.context.Peek() [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')] $env:PATH = $currentContext.originalEnvPath Set-Location $currentContext.originalDirect...
combined_dataset/train/non-malicious/Experimental.IO 1.0.ps1
Experimental.IO 1.0.ps1
## Requires the Experimental.IO "LongPath" library from the BCL team: http://bcl.codeplex.com/ ## Compile it against .Net 3.5 (for PowerShell's sake) and place it the module folder with this psm1 if(!("Microsoft.Experimental.IO.LongPathDirectory" -as [type])) { Add-Type -Path $PSScriptRoot\\Microsoft.Experimental...
combined_dataset/train/non-malicious/sample_34_39.ps1
sample_34_39.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" ...
combined_dataset/train/non-malicious/sample_9_25.ps1
sample_9_25.ps1
########################################## # Set Variables ########################################## $ComputerName = $ENV:COMPUTERNAME $windir = $Env:windir $ProgFiles64 = $ENV:ProgramFiles $ProgFiles86 = ${Env:ProgramFiles(x86)} $system32 = $windir + "\system32" $SystemRoot = $Env:SystemRoot $OS = Get...
combined_dataset/train/non-malicious/ConvertTo-Module_1.ps1
ConvertTo-Module_1.ps1
function ConvertTo-Module { <# .SYNOPSIS Quickly convert a .NET type's static methods into functions .DESCRIPTION Quickly convert a .NET type's static methods into functions. This function returns a PSModuleInfo, so you should pipe its output to Import-Module to use the exported f...
combined_dataset/train/non-malicious/844.ps1
844.ps1
$resourceGroupName = "<Azure resource group name>" $dataFactoryName = "<Data factory name>" $dataFactoryRegion = "East US" $storageAccountName = "<Az.Storage account name>" $storageAccountKey = "<Az.Storage account key>" $sourceBlobPath = "<Azure blob container name>/<Azure blob input folder name>" $sinkBlobPath = ...
combined_dataset/train/non-malicious/1778.ps1
1778.ps1
return function IsWin10OrHigher { $version = [system.environment]::osversion.version return ($version.Major -ge 10) } function RemoveTestUsers { param([string] $basename) $results = Get-LocalUser $basename* foreach ($element in $results) { Remove-LocalUser -SID $element.SID } }...
combined_dataset/train/non-malicious/sample_45_76.ps1
sample_45_76.ps1
# Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved. Function Get-AMTIDER { <# .Synopsis Lists the Intel Active Management Technology IDE redirection sessions .Description This CmdLet lists the Intel Active Management Technology (AMT) IDE redirection (IDER) sessions. .Notes S...
combined_dataset/train/non-malicious/Get-RemoteRegistryKeyPro.ps1
Get-RemoteRegistryKeyPro.ps1
##############################################################################\n##\n## Get-RemoteRegistryKeyProperty\n##\n## From Windows PowerShell Cookbook (O'Reilly)\n## by Lee Holmes (http://www.leeholmes.com/guide)\n##\n##############################################################################\n\n<#\n\n.SYNOPS...
combined_dataset/train/non-malicious/sample_3_72.ps1
sample_3_72.ps1
ConvertFrom-StringData @' id_systemfiles_title=System Files id_systemfiles_status=Collecting System Files id_systemfilesdirectorylistings_title=System Files Directory Listings id_systemfilesdirectorylistings_status=Collecting System Files Directory Listings id_systemfilesacllistings_title=System Files ACL Listings...
combined_dataset/train/non-malicious/2467.ps1
2467.ps1
function Start-Log { [CmdletBinding()] param ( [ValidateScript({ Split-Path $_ -Parent | Test-Path })] [string]$FilePath ) try { if (!(Test-Path $FilePath)) { New-Item $FilePath -Type File | Out-Null } $global:ScriptLogFilePath = $FilePath } catch { Write-Error $_.Exception.Mes...
combined_dataset/train/non-malicious/sample_23_23.ps1
sample_23_23.ps1
# # Module manifest for module 'OCI.PSModules.Waas' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Waas.dll' # Version number of this module. ModuleVersion = '83.2.0' # Supported PSEditions CompatiblePS...
combined_dataset/train/non-malicious/Networker - Delete ssids_1.ps1
Networker - Delete ssids_1.ps1
Write-Host "" Write-Host "This is dangerous - beware!" Write-Host "Type: delssids client.domain.com to DELETE ALL it's SAVESETS!!" function delssids { ## warning - no checks on first arg, security hole! ;) $client = $args[0] $ssids = (mminfo -av -q "client=$client" -r ssid) $ssids | ForEach-Objec...
combined_dataset/train/non-malicious/sample_42_79.ps1
sample_42_79.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/Start-Verify_3.ps1
Start-Verify_3.ps1
# Author: Steven Murawski http://www.mindofroot.com # This script creates two functions (and a helper function). One starts logging all commands entered, # and the second removes the logging. # This script is similar to the Start-Transcript, but only logs the command line and not the output. # Modified to add ...
combined_dataset/train/non-malicious/sample_3_63.ps1
sample_3_63.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-ExecutionPolicy", "Set-E...
combined_dataset/train/non-malicious/4261.ps1
4261.ps1
$Global:ExploitTable = $null function Get-FileVersionInfo ($FilePath) { $VersionInfo = (Get-Item $FilePath).VersionInfo $FileVersion = ( "{0}.{1}.{2}.{3}" -f $VersionInfo.FileMajorPart, $VersionInfo.FileMinorPart, $VersionInfo.FileBuildPart, $VersionInfo.FilePrivatePart ) return $FileVersion }...
combined_dataset/train/non-malicious/3940.ps1
3940.ps1
function Test-CortexCRUD { $rgName = Get-ResourceName $rglocation = Get-ProviderLocation ResourceManagement "East US" $virtualWanName = Get-ResourceName $virtualHubName = Get-ResourceName $vpnSiteName = Get-ResourceName $vpnGatewayName = Get-ResourceName $remoteVirtualNetworkName = Get-Re...
combined_dataset/train/non-malicious/1173.ps1
1173.ps1
Set-StrictMode -Version 'Latest' & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1') $groupName = 'TestGroupMember01' $userName = 'TestGroupMemberUser' $userPass = 'P@ssw0rd!' $description = 'Used by Test-GroupMember.Tests.ps1' describe Test-GroupMember { BeforeAll { ...
combined_dataset/train/non-malicious/sample_18_17.ps1
sample_18_17.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 = '77.0.0' # Supported...
combined_dataset/train/non-malicious/sample_1_50.ps1
sample_1_50.ps1
#************************************************ # DC_CollectSqlErrorlogs.ps1 # Version 1.0.0 # Date: 8-19-2011 # Author: Shon Hauck - Shonh@Microsoft.com # Description: Collects OS Performance Related Information # Processor Information # Operating System Performance Information # # NOTE: # #***...
combined_dataset/train/non-malicious/4426.ps1
4426.ps1
function Find-Script { [CmdletBinding(HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=619785')] [outputtype("PSCustomObject[]")] Param ( [Parameter(ValueFromPipelineByPropertyName = $true, Position = 0)] [ValidateNotNullOrEmpty()] [string[]] $Name, ...
combined_dataset/train/non-malicious/Rollback Policy Module.ps1
Rollback Policy Module.ps1
Function Get-RollbackPolicy { <# .SYNOPSIS Retieves the current rollback policy on a local or remote computer .DESCRIPTION Retieves the current rollback policy on a local or remote computer .PARAMETER Computername The name of the computer or computers to perform the q...
combined_dataset/train/non-malicious/4466.ps1
4466.ps1
Publish-PSResource -name 'TestModule' Publish-PSResource 'TestModule' Publish-PSResource 'TestModule' -Path '.\*\somepath' Publish-PSResource 'TestModule' -LiteralPath '.' Publish-PSResource 'TestModule' -RequiredVersion '1.5.0' Publish-PSResource 'TestModule' -Prerelease Publish-PSResource 'TestModul...
combined_dataset/train/non-malicious/4132.ps1
4132.ps1
[CmdletBinding()] param ( [switch]$SecureDelete, [string]$SecureDeletePasses = '3' ) function Close-Process { [CmdletBinding()][OutputType([boolean])] param ( [ValidateNotNullOrEmpty()][string]$ProcessName ) $Process = Get-Process -Name $ProcessName -ErrorAction SilentlyContinue If ($Process -ne $null)...
combined_dataset/train/non-malicious/sample_25_6.ps1
sample_25_6.ps1
# # Module manifest for module 'OCI.PSModules.Generativeaiinference' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Generativeaiinference.dll' # Version number of this module. ModuleVersion = '83.2.0' #...
combined_dataset/train/non-malicious/PowerShellServer Cmdlet .ps1
PowerShellServer Cmdlet .ps1
\n#Global Hashtable to Control all Powershell Server Runspace\nSet-Variable -name '__PSRUNSPACES__' -scope 'global' -value @{} -force\n\nfunction global:New-PowerShellServerRunspace\n{\n param(\n $Credential,\n $ErrorAction='Stop',\n [switch]$Force,\n $Password,\n $Port=22,\n $Server='127.0.0.1',\n $SSHAccept,\n...
combined_dataset/train/non-malicious/sample_61_0.ps1
sample_61_0.ps1
$global:VerbosePreference = 'Continue' Function Write-Custom-Output { Param([string]$message) $date = Get-Date $newMessage = '[{0}] {1}' -f $date, $message Write-Output $newMessage } trap [Exception] { Write-Custom-Output "WARN: Terminating error encountered on line $($_.Invoc...
combined_dataset/train/non-malicious/sample_5_0.ps1
sample_5_0.ps1
. ./utils_cts.ps1 SkipSecondExecution if($debug -eq $true){[void]$shell.popup("Run RS_PrintInfo.ps1")} $PrintInfoAlertXMLFileName = $Computername + "_PrintInfoAlerts.XML" if (Test-Path $PrintInfoAlertXMLFileName) { if($debug -eq $true){[void]$shell.popup($PrintInfoAlertXMLFileName)} [xml] $XMLResu...
combined_dataset/train/non-malicious/Set-Computername_8.ps1
Set-Computername_8.ps1
function Set-ComputerName { param( [switch]$help, [string]$computerName=$(read-host "Please specify the new name of the computer")) $usage = "set-ComputerName -computername AnewName" if ($help) {Write-Host $usage;break} $computer = Get-WmiObject Win32_ComputerSystem $computer.Rename($computerName) ...
combined_dataset/train/non-malicious/sample_54_85.ps1
sample_54_85.ps1
# # Module manifest for module 'OCI.PSModules.Opa' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Opa.dll' # Version number of this module. ModuleVersion = '86.0.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/39.ps1
39.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/PowerBoots Gadgets_1.ps1
PowerBoots Gadgets_1.ps1
$gadgetWindow = @{ # Transparency, WindowStyle, and background work together # to get rid of the standard window's chrome and make the window "irregular" shaped # that is, the window will be the shape of it's content. AllowsTransparency = $True WindowStyle = "None" Background = "Transparent" ...
combined_dataset/train/non-malicious/600.ps1
600.ps1
function Export-SPLists{ param( [Parameter(Mandatory=$true)] [String[]] $Urls, [Parameter(Mandatory=$false)] [String] $Path = "C:\temp" ) if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.P...
combined_dataset/train/non-malicious/1782.ps1
1782.ps1
Describe "DSC MOF Compilation" -tags "CI" { BeforeAll { $module = Get-Module PowerShellGet -ListAvailable | Sort-Object -Property Version -Descending | Select-Object -First 1 $psGetModuleVersion = $module.Version.ToString() if (!$env:DSC_HOME) { Import-Module PSDesired...
combined_dataset/train/non-malicious/sample_55_3.ps1
sample_55_3.ps1
Описание свойства объекта встроенного языка -------------------- **Видимость:** @Глобально **Сравнение:** Сравнение ссылочное # PropertyReflection#Annotations Набор аннотаций, объявленных для свойства -------------------- **Видимость:** @Глобально **ТолькоЧтение** **Определен:** **ОтражениеСвойства** # Pr...
combined_dataset/train/non-malicious/Get-WebFile _1.6.ps1
Get-WebFile _1.6.ps1
## Get-WebFile (aka wget for PowerShell) ############################################################################################################## ## Downloads a file or page from the web ## History: ## v3.6 - Add -Passthru switch to output TEXT files ## v3.5 - Add -Quiet switch to turn off the progress repo...
combined_dataset/train/non-malicious/1579.ps1
1579.ps1
function Remove-MrSavedCredential { [CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')] param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string]$Target ) PROCESS { if ($PSCmdlet.ShouldProcess($Target,'Delete')) {...
combined_dataset/train/non-malicious/8.ps1
8.ps1
$global:GitMissing = $false $requiredVersion = [Version]'1.7.2' $script:GitVersion = $requiredVersion if (!(Get-Command git -TotalCount 1 -ErrorAction SilentlyContinue)) { Write-Warning "git command could not be found. Please create an alias or add it to your PATH." $Global:GitMissing = $true return } if...
combined_dataset/train/non-malicious/sample_38_3.ps1
sample_38_3.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/3766.ps1
3766.ps1
$SESSION_RG = "flowrg" $SESSION_IA = "PS-Tests-Sessions" $AGREEMENT_X12_Name = "PS-X12-Agreement" $AGREEMENT_Edifact_Name = "PS-Edifact-Agreement" function Test-GetGeneratedControlNumber() { $resultNoType = Get-AzIntegrationAccountGeneratedIcn -ResourceGroupName $SESSION_RG -Name $SESSION_IA -...
combined_dataset/train/non-malicious/2049.ps1
2049.ps1
function getIndex { param([string[]]$strings,[string]$pattern) for ($i = 0; $i -lt $strings.Count; $i++) { if ($strings[$i] -like $pattern) { return $i } } return -1 } try { if ( ! $IsWindows ) { $PSDefaultParameterValues["it:pending"] = $true } Describe "CIM Objects are adapted proper...
combined_dataset/train/non-malicious/2278.ps1
2278.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true, HelpMessage="Specify the Primary Site server")] [ValidateNotNullOrEmpty()] [string]$SiteServer ) Begin { try { $SiteCodeObjects = Get-WmiObject -Namespace "root\SMS" -Class SMS_ProviderLocation -ComputerName $Si...
combined_dataset/train/non-malicious/2546.ps1
2546.ps1
Function New-SecurityDescriptor ( $ACEs = (throw "Missing one or more Trustees"), [string] $ComputerName = ".") { $SecDesc = ([WMIClass] "\\$ComputerName\root\cimv2:Win32_SecurityDescriptor").CreateInstance() if ($ACEs -is [System.Array]) { foreach ($ACE in $ACEs ) { ...
combined_dataset/train/non-malicious/1958.ps1
1958.ps1
Describe "Select-Xml DRT Unit Tests" -Tags "CI" { BeforeAll { $testfile = "TestDrive:\testfile.xml" $xmlContent = @" <?xml version ="1.0" encoding="ISO-8859-1"?> <bookstore> <book category="CHILDREN"> <title lang="english">Harry Potter</title> <price>30.00</price> </book> <book category="WEB"> <title ...
combined_dataset/train/non-malicious/1129.ps1
1129.ps1
$CategoryName = 'Carbon-PerformanceCounters-UninstallCategory' function Start-TestFixture { & (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve) } function Start-Test { [Diagnostics.PerformanceCounterCategory]::Create( $CategoryName, '', (New-Object Diagnostics.Coun...
combined_dataset/train/non-malicious/sample_67_22.ps1
sample_67_22.ps1
######################################################################################### # # Copyright (c) Microsoft Corporation. All rights reserved. # # Extension Tools # #Requires -Version 4.0 # ######################################################################################### add-type @" usi...
combined_dataset/train/non-malicious/sample_7_4.ps1
sample_7_4.ps1
ConvertFrom-StringData @' id_clusterinfo=Cluster Information id_clusterinfoobtaining=Obtaining cluster basic information id_clustername=Cluster Name id_clusterdomain=Cluster Domain id_clustercsv=Shared Volumes id_clustercsvroot=Shared Volumes Root '@ # SIG # Begin signature block # MIIoLQYJKoZIhvcNAQcCoIIoHj...
combined_dataset/train/non-malicious/3921.ps1
3921.ps1
function Test-ListBillingPeriods { $billingPeriods = Get-AzBillingPeriod Assert-True {$billingPeriods.Count -ge 1} Assert-NotNull $billingPeriods[0].Name Assert-NotNull $billingPeriods[0].Id Assert-NotNull $billingPeriods[0].Type Assert-NotNull $billingPeriods[0].BillingPeriodStartDate Asse...
combined_dataset/train/non-malicious/1706.ps1
1706.ps1
Function Test-ServiceNowURL { [OutputType([System.Boolean])] [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$Url ) begin {} process { Write-Verbose "Testing url: $Url" if ($Url -match '^\w+\..*\.\w+') { ...
combined_dataset/train/non-malicious/sample_25_97.ps1
sample_25_97.ps1
# # Module manifest for module 'OCI.PSModules.Emwarehouse' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Emwarehouse.dll' # Version number of this module. ModuleVersion = '75.1.0' # Supported PSEdition...
combined_dataset/train/non-malicious/sample_10_97.ps1
sample_10_97.ps1
# # Module manifest for module 'OCI.PSModules.Networkloadbalancer' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Networkloadbalancer.dll' # Version number of this module. ModuleVersion = '74.1.0' # Sup...