full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/1807.ps1
1807.ps1
Describe "Get-EventLog cmdlet tests" -Tags @('CI', 'RequireAdminOnWindows') { BeforeAll { $defaultParamValues = $PSdefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = !$IsWindows -or $IsCoreCLR } AfterAll { $global:PSDefaultParameterValues = $defaultParamValues ...
combined_dataset/train/non-malicious/2330.ps1
2330.ps1
[CmdletBinding()] [OutputType([Amazon.Route53.Model.ChangeInfo])] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$Name, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$ZoneName, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$AliasName, [Parameter()] [Validat...
combined_dataset/train/non-malicious/4163.ps1
4163.ps1
function Get-MSIInformation { [CmdletBinding()] param ( [ValidateNotNullOrEmpty()] [System.IO.FileInfo]$MSI, [ValidateSet('ProductCode', 'ProductVersion', 'ProductName', 'Manufacturer', 'ProductLanguage', 'FullVersion')] [string]$Property ) $WindowsInstaller = New-Object -ComObject WindowsInstalle...
combined_dataset/train/non-malicious/sample_33_60.ps1
sample_33_60.ps1
@{ # Script module or binary module file associated with this manifest ModuleToProcess = 'nuget.psm1' # Version number of this module. ModuleVersion = '2.0.0.0' # ID used to uniquely identify this module GUID = '76e6f9c4-7045-44c0-a557-17fab0835c12' # Author of this module Author = 'NuGet Team' # Com...
combined_dataset/train/non-malicious/sample_28_45.ps1
sample_28_45.ps1
# Get the version of the Torizon IDE Extension from package.json $env:TEST_EXTENSION_VERSION = ((Get-Content "package.json" -Raw) | ConvertFrom-Json).version $env:TEST_VSCODE_CLEANUP = $true # Start the tests from a clean environment, unless explictly setting to false # the env variable if ($env:TEST_VSCODE_CLEANUP -E...
combined_dataset/train/non-malicious/sample_32_76.ps1
sample_32_76.ps1
# # Module manifest for module 'Microsoft.SME.EventViewer' # @{ # Script module or binary module file associated with this manifest. RootModule = 'Microsoft.SME.EventViewer.psm1' # Version number of this module. ModuleVersion = '4.11.1' # Supported PSEditions # CompatiblePSEditions = @() # ID used t...
combined_dataset/train/non-malicious/4084.ps1
4084.ps1
Clear-Host $Global:MountPath $Global:RelativePath $Global:WimFile $Global:UpdatesPath Function GetRelativePath{ $Global:RelativePath=(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" Write-Host $Global:RelativePath } Function GetWimFile{ $FileName = Get-ChildItem $Global:RelativePath | Where-Object {($...
combined_dataset/train/non-malicious/sample_1_71.ps1
sample_1_71.ps1
ConvertFrom-StringData @' id_hypervnet=Hyper-V Networking Information id_hypervnetobtaining=Obtaining advanced networking information '@ # SIG # Begin signature block # MIIoQwYJKoZIhvcNAQcCoIIoNDCCKDACAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIB...
combined_dataset/train/non-malicious/465.ps1
465.ps1
$mappings = @{ "deserialized.microsoft.activedirectory.management.addomaincontroller" = @("HostName", "Name") "microsoft.activedirectory.management.addomaincontroller" = @("HostName", "Name") "microsoft.sqlserver.management.smo.server" = @("NetName", "DomainInstanceName") "deserialized.microsoft.s...
combined_dataset/train/non-malicious/sample_32_19.ps1
sample_32_19.ps1
--- - name: Fault set Operations hosts: localhost connection: local gather_facts: false vars: hostname: 'x.x.x.x' username: 'admin' password: 'Password' validate_certs: false host_port: 443 fault_set_name: "sample_fault_set_name_1" protection_domain_name: "Ansible-PD1" tasks: ...
combined_dataset/train/non-malicious/sample_28_23.ps1
sample_28_23.ps1
# # Module manifest for module 'OCI.PSModules.Usage' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Usage.dll' # Version number of this module. ModuleVersion = '82.0.0' # Supported PSEditions Compatible...
combined_dataset/train/non-malicious/sample_46_5.ps1
sample_46_5.ps1
# # Module manifest for module 'OCI.PSModules.Identity' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Identity.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported PSEditions Comp...
combined_dataset/train/non-malicious/sample_63_50.ps1
sample_63_50.ps1
Import-LocalizedData -BindingVariable lbsTxt -FileName AzStackHci.Bootstrap.Strings.psd1 <# probably not needed would contain any tests for bootstrap that dont exist or fit in other validators #> Export-ModuleMember -Function Test-* # SIG # Begin signature block # MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglg...
combined_dataset/train/non-malicious/sample_56_37.ps1
sample_56_37.ps1
#requires -Version 5.0 enum BcArtifactSource { OnPrem Sandbox Insider } #Import-Module (Join-Path $PSScriptRoot ClientContext\ClientContext.psd1) #Import-Module (Join-Path $PSScriptRoot ClientContext\ClientContext.psm1) #. "$PSScriptRoot\ClientContext\ClientContextLibLoader.ps1" -BcLibVersion (G...
combined_dataset/train/non-malicious/3017.ps1
3017.ps1
Set-StrictMode -Version Latest if ($PSVersionTable.PSVersion.Major -le 2) { return } InModuleScope Pester { function Clear-WhiteSpace ($Text) { "$($Text -replace "(`t|`n|`r)"," " -replace "\s+"," " -replace "\s*<","<" -replace ">\s*", ">")".Trim() } Describe 'Code Coverage A...
combined_dataset/train/non-malicious/3440.ps1
3440.ps1
[CmdletBinding()] Param( [Parameter(Mandatory=$False, Position=0)] [String]$Folder, [Parameter(Mandatory=$False)] [bool]$Major, [Parameter(Mandatory=$False)] [bool]$Minor, [Parameter(Mandatory=$False)] [bool]$Patch ) function ReplaceVersion([string]$key, [string]$line) { $matches = ([regex]::matches($line, "$key\s*=\...
combined_dataset/train/non-malicious/sample_2_62.ps1
sample_2_62.ps1
<# .SYNOPSIS DEV Components and Scenarios module for learning and demoing TSS Framework usage. This is NOT related to any specific POD and not designed for learning and troubleshooting. .DESCRIPTION DEV Components and Scenarios module for learning and demoing TSS Framework usage. This is NOT related...
combined_dataset/train/non-malicious/3335.ps1
3335.ps1
function Get-CommandStatus { [PoshBot.BotCommand( Aliases = ('getcommandstatus', 'commandstatus') )] [cmdletbinding()] param( [parameter(Mandatory)] $Bot ) $activeJobs = @($Bot.Executor._jobTracker.GetEnumerator() | Foreach-Object { $userId = $_.Value.Parse...
combined_dataset/train/non-malicious/LibraryChart_2.ps1
LibraryChart_2.ps1
# --------------------------------------------------------------------------- ### <Script> ### <Author> ### Chad Miller ### </Author> ### <Description> ### Defines functions for wokring with Microsoft Chart Control for .NET 3.5 Framework ### Pipe output of Powershell command to Out-Chart function and specify c...
combined_dataset/train/non-malicious/sample_39_85.ps1
sample_39_85.ps1
# SharePoint references that need to remove when uninstall $ReferencesToRemoveWhenUninstall = @( @("Microsoft.SharePoint.Client"), @("Microsoft.SharePoint.Client.Runtime"), @("System.IdentityModel.Tokens.Jwt"), @("Microsoft.IdentityModel.Tokens") ) # SharePoint references that need to be copy l...
combined_dataset/train/non-malicious/Enable-RemoteCredSSP.ps1
Enable-RemoteCredSSP.ps1
##############################################################################\n##\n## Enable-RemoteCredSSP\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\nEna...
combined_dataset/train/non-malicious/BufferBox 3.5.ps1
BufferBox 3.5.ps1
#################################################################################################### ## This script is just a demonstration of some of the things you can do with the buffer ## in the default PowerShell host... it serves as a reminder of how much work remains on ## PoshConsole, and as an inspiration t...
combined_dataset/train/non-malicious/Dell Order Status_1.ps1
Dell Order Status_1.ps1
# Version: 0.1 # Author: Stefan Stranger # Description: Retrieve Dell Order Status # Start Page Order Status USA: https://support.dell.com/support/order/status.aspx?c=us&cs=19&l=en&s=dhs&~ck=pn # Start Page Order Status EMEA(nl): http://support.euro.dell.com/support/index.aspx?c=nl&l=nl&s=gen&~ck=bt # Example Dell...
combined_dataset/train/non-malicious/4074.ps1
4074.ps1
[CmdletBinding()] param ( [switch]$SystemInstall, [ValidateNotNullOrEmpty()][string]$InstallLocation = 'C:\windows\system32', [switch]$UserConfig, [ValidateNotNullOrEmpty()][string]$PSConsoleTitle = 'CMTrace Installation' ) function Close-Process { [CmdletBinding()] param ( [ValidateNotNullOrEmpty()]...
combined_dataset/train/non-malicious/ESXiMgmt module sample 4.ps1
ESXiMgmt module sample 4.ps1
####################################################################################################################### # File: ESXiMgmt_search_for_guest_hostname_sample.ps1 # # Author: Alexander Petrovskiy ...
combined_dataset/train/non-malicious/ConvertTo-CliXml_2.ps1
ConvertTo-CliXml_2.ps1
#requires -version 2.0 function ConvertTo-CliXml { param( [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] [ValidateNotNullOrEmpty()] [PSObject[]]$InputObject ) begin { $type = [type]::gettype("System.Management.Automation.Serializer") $ctor ...
combined_dataset/train/non-malicious/2773.ps1
2773.ps1
function Compute-FileHash { Param( [Parameter(Mandatory = $true, Position=1)] [string]$FilePath, [ValidateSet("MD5","SHA1","SHA256","SHA384","SHA512","RIPEMD160")] [string]$HashType = "MD5" ) switch ( $HashType.ToUpper() ) { "MD5" { $hash = [System.Security.Cryptography.MD5...
combined_dataset/train/non-malicious/sample_1_38.ps1
sample_1_38.ps1
<# ISM PowerShell Service Module This module contains a set of wrapper scripts that enable Administrator To invoke iDRAC hard reset operation from host server. #> function IsAdministrator { <# .SYNOPSIS IsAdministrator. .DESCRIPTION Use IsAdministrator to get whether the user has an...
combined_dataset/train/non-malicious/3119.ps1
3119.ps1
function Get-InstalledSoftware { [CmdletBinding()] param( [Parameter( Position=0, HelpMessage='Search for product name (You can use wildcards like "*ProductName*')] [String]$Search, [Parameter( Position=1, HelpMessage='ComputerName or IPv4-Address of the remote computer')] [String]$Com...
combined_dataset/train/non-malicious/Event Log SOX audit.ps1
Event Log SOX audit.ps1
$s = "Server01", "Server02", "Server03" foreach($server in $s) {$server #$computername = Get-Content env:computername $filter_Security = '<QueryList> <Query Id="0" Path="Security"> <Select Path="Security">(*[System[Provider[@Name="Microsoft-Windows-Security-Auditing"] and (Task = 13824 or Task = 13825 or Ta...
combined_dataset/train/non-malicious/2263.ps1
2263.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true, HelpMessage="Site server where the SMS Provider is installed.")] [ValidateNotNullOrEmpty()] [ValidateScript({Test-Connection -ComputerName $_ -Count 1 -Quiet})] [string]$SiteServer, [parameter(Mandatory=$true, HelpMess...
combined_dataset/train/non-malicious/sample_40_34.ps1
sample_40_34.ps1
########################################################### # # 'ServiceHelper' module # ########################################################### $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest $global:GCServiceName = "GCService" $script:GCServiceBinaryName = "gc_service.exe" $script:GC...
combined_dataset/train/non-malicious/sample_23_26.ps1
sample_23_26.ps1
parameters: - name: channel type: string default: 1.77 - name: targets default: [] type: object # Todo: use 1ES pipeline once extension is installed in ADO steps: - task: RustInstaller@1 inputs: rustVersion: ms-${{ parameters.channel }} cratesIoFeedOverride: $(CARGO_REGISTRY) ...
combined_dataset/train/non-malicious/NFSMountUsingReference.ps1
NFSMountUsingReference.ps1
################################################################################################################ # VMWare Standard Scripts - PowerCLI # # Purpose: Mount NFS datastore on new host server using reference host datstore # Author: David Chung # Docs: NA # Date: 2/4/2012 # # # Instruction:...
combined_dataset/train/non-malicious/1403.ps1
1403.ps1
function Test-CPerformanceCounterCategory { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string] $CategoryName ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState return [Diagnos...
combined_dataset/train/non-malicious/3546.ps1
3546.ps1
function Create-VM( [string] $resourceGroupName, [string] $location, [int] $nick = 0) { $suffix = $(Get-RandomSuffix 5) + $nick $vmName = "PSTestVM" + $suffix $vm = Get-AzVM -ResourceGroupName $resourceGroupName -Name $vmName -ErrorAction Ignore if ($vm -eq $null) { $subnetConfigName = "PSTe...
combined_dataset/train/non-malicious/Get-ChildItemProxy.ps1
Get-ChildItemProxy.ps1
Function Get-ChildItemProxy { [CmdletBinding(DefaultParameterSetName='Items', SupportsTransactions=$true)] param( [Parameter(ParameterSetName='Items', Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [System.String[]] ${Path}, [Parameter(ParameterSetName='LiteralItems...
combined_dataset/train/non-malicious/4112.ps1
4112.ps1
Set-Variable -Name FileName -Scope Global -Force Set-Variable -Name Log -Scope Global -Force Function DeleteLogFiles { Set-Variable Count -Scope Local -Force Set-Variable Files -Scope Local -Force Set-Variable i -Scope Local -Force $Months = @("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov"...
combined_dataset/train/non-malicious/2106.ps1
2106.ps1
Describe "Native streams behavior with PowerShell" -Tags 'CI' { $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" Context "Error stream" { $error.Clear() $command = [string]::Join('', @( '[Console]::Error.Write(\"foo`n`nbar`n`nbaz\"); ', '[Con...
combined_dataset/train/non-malicious/Backup Rotation (7zip).ps1
Backup Rotation (7zip).ps1
First file RotateBackups_MasterList.txt RowNbr,BackupName,VersionsRetained,BackupType 1,TargetBackup,2,Folder 2,LstDefBackup,5,File 3,XMLBackup,3,File 4,SourceBackup,2,Folder 5,TXTBackup,8,File Second file RotateBackups_FolderList.txt RowNbr,BackupName,FolderName 1,TargetBackup,c:\\MyBooks\\target 2,SourceB...
combined_dataset/train/non-malicious/3781.ps1
3781.ps1
function Test-SyncGroup { $resourceGroupName = Get-ResourceGroupName Write-Verbose "RecordMode : $(Get-StorageTestMode)" try { $storageSyncServiceName = Get-ResourceName("sss") $syncGroupName = Get-ResourceName("sg") $resourceGroupLocation = Get-Resou...
combined_dataset/train/non-malicious/sample_11_58.ps1
sample_11_58.ps1
@{ GUID = 'C46BE3DC-30A9-452F-A5FD-4BF9CA87A854' Author="Microsoft Corporation" CompanyName="Microsoft Corporation" Copyright="Copyright (C) Microsoft Corporation. All rights reserved." ModuleVersion = '1.0' NestedModules = @( 'MSFT_MpComputerStatus.cdxml', 'MSFT_Mp...
combined_dataset/train/non-malicious/1139.ps1
1139.ps1
Set-StrictMode -Version 'Latest' & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve) Describe 'Get-ServiceConfiguration' { BeforeEach { $Global:Error.Clear() } It 'should load all service configuration' { Get-Service | Wh...
combined_dataset/train/non-malicious/2262.ps1
2262.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true)] $DriveLetter, [parameter(Mandatory=$true)] $ShareName, [parameter(Mandatory=$true)] $ADGroup, [parameter(Mandatory=$false)] [switch]$CreateDFS ) $ErrorActionPreference = "Stop" try { [System.Reflection.Assembly]::LoadWithPartialName...
combined_dataset/train/non-malicious/2430.ps1
2430.ps1
[CmdletBinding()] param ( [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)] [string[]]$ServiceName, [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] [ValidateScript({Test-Connection -ComputerName $_ -Quiet -Count 1 })] [string[]]$Computername = 'localhost', [Parameter(Mandat...
combined_dataset/train/non-malicious/sample_65_10.ps1
sample_65_10.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.26...
combined_dataset/train/non-malicious/View-Process.ps1
View-Process.ps1
function View-Process { param( [string[]]$ComputerNames, [string[]]$ProcessNames, $User ) ########################################################################################################### if ($User -is [String]) { $Connection = Get-Credential -Credential $User } ###################################...
combined_dataset/train/non-malicious/sample_52_4.ps1
sample_52_4.ps1
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. function ConvertFrom-ScriptExtent { <# .EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml #> [CmdletBinding()] [OutputType([Microsoft.PowerShell.EditorServices.Extensions.IFileRange, Microsoft.PowerShell.Edito...
combined_dataset/train/non-malicious/New-XVM_10.ps1
New-XVM_10.ps1
Function New-XVM { [cmdletbinding()] Param ( [Parameter(Mandatory=$false,Position=1)] [string]$ComputerName=$env:COMPUTERNAME, [Parameter(Mandatory=$true,Position=2)] [string]$Name, [Parameter(Mandatory=$true,Position=3)] [string]$SwitchName,...
combined_dataset/train/non-malicious/Reflection_1.ps1
Reflection_1.ps1
$nul = "<NULL>" function Get-AssembliesTree { [AppDomain]::CurrentDomain.GetAssemblies() | % { $nod = New-Object Windows.Forms.TreeNode $nod.Text = $_.GetName().Name $nod.Tag = $_ $tvAssem.Nodes.Add($nod) $nod.Nodes.Add($nul) } } function Add-Types { $_.Node.Nodes.Clear() ...
combined_dataset/train/non-malicious/Spread-Mailboxes.ps1
Spread-Mailboxes.ps1
########################################################################### # # NAME: Spread-Mailboxes.ps1 # # AUTHOR: Jan Egil Ring # EMAIL: jer@powershell.no # # COMMENT: Script to spread mailboxes alphabetically across mailboxdatabases based on the first character in the user`s displayname. # For mo...
combined_dataset/train/non-malicious/834.ps1
834.ps1
class AsrCommon { [psobject]$Logger AsrCommon($logger) { $this.Logger = $logger } [psobject] GetAndEnsureVaultContext($vaultName) { $this.Logger.LogTrace("Ensuring services vault context '$($vaultName)'") $targetVault = Get-AzureRmRecoveryServicesVault -Name $vaultName ...
combined_dataset/train/non-malicious/1101.ps1
1101.ps1
function Start-TestFixture { & (Join-Path -Path $PSScriptRoot '..\Initialize-CarbonTest.ps1' -Resolve) } function Test-ShouldGetAllMimeTypes { $mimeMap = Get-IisMimeMap Assert-NotNull $mimeMap Assert-True ($mimeMap.Length -gt 0) $mimeMap | ForEach-Object { Assert-True ($_.F...
combined_dataset/train/non-malicious/3900.ps1
3900.ps1
function Test-GetNonExistingBatchAccount { Assert-Throws { Get-AzBatchAccount -Name "accountthatdoesnotexist" } } function Test-BatchAccountEndToEnd { $accountName = Get-BatchAccountName $resourceGroup = Get-ResourceGroupName try { $location = Get-BatchAccountProvider...
combined_dataset/train/non-malicious/Dir for days_2.ps1
Dir for days_2.ps1
Function Create-DatePaths { Param ( [Parameter(Position=0,Mandatory=$True)] [DateTime] $Start, [Parameter(Position=1,Mandatory=$True)] [ValidateScript({$_ -gt $Start})] [DateTime] $End, $DestinationPath=(Join-Path $env:UserProfile "Test") ) 0..(New-...
combined_dataset/train/non-malicious/sample_31_97.ps1
sample_31_97.ps1
# # Module manifest for module 'OCI.PSModules.Aispeech' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Aispeech.dll' # Version number of this module. ModuleVersion = '81.0.0' # Supported PSEditions Comp...
combined_dataset/train/non-malicious/631.ps1
631.ps1
param( [string]$Version, [string]$Path, [switch]$Force, $Update, [switch]$Uninstall ) $Configs = @{ Url = "https://bitbucket.org/splatteredbits/carbon/downloads/Carbon-1.7.0.zip" Path = "$(Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)\" } $Configs | ForEach-Object{ try{ $_.Resu...
combined_dataset/train/non-malicious/3416.ps1
3416.ps1
function Test-AzureProvider { $defaultProviders = Get-AzureRmResourceProvider Assert-True { $defaultProviders.Length -gt 0 } $allProviders = Get-AzureRmResourceProvider -ListAvailable Assert-True { $allProviders.Length -gt $defaultProviders.Length } $ErrorActionPreference = "SilentlyCo...
combined_dataset/train/non-malicious/2527.ps1
2527.ps1
function New-CodeSigningCertificate { [CmdletBinding()] param( [Security.Cryptography.X509Certificates.X500DistinguishedName]$Subject = "CN=PowerGUI User", [ValidateSet(1024,2048)] ...
combined_dataset/train/non-malicious/sample_58_40.ps1
sample_58_40.ps1
param( [Parameter(Mandatory = $true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored [Parameter(Mandatory = $true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation [Parameter(Mandatory = $true)][string] $DotnetSymbol...
combined_dataset/train/non-malicious/sample_11_53.ps1
sample_11_53.ps1
##---------------------------------------------------------------------------- ## Copyright (c) Axis Communications AB, SWEDEN. All rights reserved. ##---------------------------------------------------------------------------- # Import string constants . ./StringConstants.ps1 # Import shared functions and var...
combined_dataset/train/non-malicious/sample_38_4.ps1
sample_38_4.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/sample_52_85.ps1
sample_52_85.ps1
# # Module manifest for module 'Az.MachineLearning' # # Generated by: Microsoft Corporation # # Generated on: 5/16/2024 # @{ # Script module or binary module file associated with this manifest. RootModule = 'Az.MachineLearning.psm1' # Version number of this module. ModuleVersion = '1.1.4' # Supporte...
combined_dataset/train/non-malicious/225.ps1
225.ps1
function Get-ScriptAlias { [CmdletBinding()] PARAM ( [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] [ValidateScript({ Test-Path -Path $_ })] [Alias("FullName")] [System.String[]]$Path ) PROCESS { FOREACH ($File in $Path) { TRY { $ScriptContent = (Get-Content $File -Del...
combined_dataset/train/non-malicious/Get-LocalGroups_1.ps1
Get-LocalGroups_1.ps1
function Add-NoteProperty { <# .Synopsis Adds a NoteProperty member to an object. .Description This function makes adding a property a lot easier than Add-Member, assuming you want to add a NoteProperty, which I find is true about 90% of the time. .Parameter object The object to add the property to. ...
combined_dataset/train/non-malicious/Harley.ps1
Harley.ps1
### # Description: Add Voice to Powershell # Version: 1.1 (11 Nov 2008) # Mike Hays / www.mike-hays.net / blog.mike-hays.net # Virtualization, Powershell, and more... ### # This is the actual speaking part. I cheat by adding spaces # (This makes the word sound right). $spokenText = "Super ca li fragilistic e...
combined_dataset/train/non-malicious/783e4a84-4d47-4c57-a257-2298ce2b32ff.ps1
783e4a84-4d47-4c57-a257-2298ce2b32ff.ps1
Function Get-DiskUsage { <# .SYNOPSIS A tribute to the excellent Unix command DU. .DESCRIPTION This command will output the full path and the size of any object and it's subobjects. Using just the Get-DiskUsage command without any parameters will result in an output of the directory you are currently p...
combined_dataset/train/non-malicious/List DHCP Clients .ps1
List DHCP Clients .ps1
$DHCP_EnumSubnetClients = @' [DllImport("dhcpsapi.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern uint DhcpEnumSubnetClients( string ServerIpAddress, uint SubnetAddress, ref uint ResumeHandle, uint PreferredMaximum, out IntPtr ClientInfo, ref uint E...
combined_dataset/train/non-malicious/198.ps1
198.ps1
function Get-SCSMWorkItemCreatedByUser { [CmdletBinding(DefaultParameterSetName = 'GUID')] param ( [Parameter(ParameterSetName = 'SMObject', Mandatory = $true, ValueFromPipeline = $true)] $SMObject, [Parameter(ParameterSetName = 'GUID', ...
combined_dataset/train/non-malicious/sample_7_8.ps1
sample_7_8.ps1
$debug = $false $vmmskey = "HKLM:\SYSTEM\CurrentControlSet\Services\vmms" if (Test-Path $vmmskey) { Import-LocalizedData -BindingVariable HyperVNetStrings #Hyper-V Networking info Write-DiagProgress -Activity $HyperVNetStrings.ID_HyperVNet -Status $HyperVNetStrings.ID_HyperVNetObtaining ...
combined_dataset/train/non-malicious/count-object.ps1
count-object.ps1
#a function to count how many items there are, whether its an array, a collection, or actually just # a single no array/non list/non collection object in which case it would be 1 function count ($InputObject) { if ($inputobject -eq $Null ) { return 0} if ($inputobject -is [system.array]) { return $inputobject.le...
combined_dataset/train/non-malicious/1221.ps1
1221.ps1
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Initialize-CarbonTest.ps1' -Resolve) $shareName = 'CarbonGetFileShare' $sharePath = $null $shareDescription = 'Share for testing Carbon''s Get-FileShare function.' function Start-TestFixture { $sharePath = New-TempDirectory -Prefix $PSCommandPath Inst...
combined_dataset/train/non-malicious/1758.ps1
1758.ps1
"Hello from PowerShell!" python3 -c @" print(' Hello from Python!') print(' Python and PowerShell get along great!') "@ "Back to PowerShell." "Bye now!"
combined_dataset/train/non-malicious/sample_7_1.ps1
sample_7_1.ps1
BT /GS0 gs /TT0 1 Tf -0.0003 Tc 10.02 0 0 10.02 72 709.98 Tm (c.)Tj /TT1 1 Tf -0.0007 Tc 0.0011 Tw 1.796 0 Td [(If you are a )5.9(MPN )5.9(Member)]TJ /TT0 1 Tf 0 Tc 0 Tw 12.784 0 Td (:)Tj -0.001 Tc -12.784 -1.204 Td (i.)Tj -0.0003 Tc -0.0008 Tw 1.796 0 Td [(Each licen)6.4(se )6(acquired on b)7.5(e)-0.9(half of y)6.7(o)...
combined_dataset/train/non-malicious/sample_35_41.ps1
sample_35_41.ps1
# # Module manifest for module 'OCI.PSModules.Disasterrecovery' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Disasterrecovery.dll' # Version number of this module. ModuleVersion = '77.0.0' # Supported...
combined_dataset/train/non-malicious/1164.ps1
1164.ps1
Set-StrictMode -Version 'Latest' $parentFSPath = $null $childFSPath = $null $originalAcl = $null & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve) function Assert-AclInheritanceDisabled { param( $Path ) It 'should disable access rule inheritance' { ...
combined_dataset/train/non-malicious/2142.ps1
2142.ps1
Describe "Using assembly" -Tags "CI" { try { Push-Location $PSScriptRoot $guid = [Guid]::NewGuid() Add-Type -OutputAssembly $PSScriptRoot\UsingAssemblyTest$guid.dll -TypeDefinition @" public class ABC {} "@ It 'parse reports error on non-existing assembly by relative path' ...
combined_dataset/train/non-malicious/1008.ps1
1008.ps1
$myTopic = "<your-custom-topic-name>" $myEndpoint = "<your-endpoint-URL>" $myResourceGroup = "<resource-group-name>" New-AzResourceGroup -Name $myResourceGroup -Location westus2 New-AzEventGridTopic -ResourceGroupName $myResourceGroup -Name $myTopic -Location westus2 New-AzEventGridSubscription ` -EventSu...
combined_dataset/train/non-malicious/3267.ps1
3267.ps1
class RoleManager : BaseLogger { [hashtable]$Groups = @{} [hashtable]$Permissions = @{} [hashtable]$Roles = @{} [hashtable]$RoleUserMapping = @{} hidden [object]$_Backend hidden [StorageProvider]$_Storage hidden [string[]]$_AdminPermissions = @('manage-roles', 'show-help' ,'view', 'view-rol...
combined_dataset/train/non-malicious/2919.ps1
2919.ps1
task default -depends Test task Test -depends Compile, Clean { Assert $false "This fails." } task Compile -depends Clean { "Compile" } task Clean { "Clean" } taskTearDown { "$($psake.context.Peek().currentTaskName) Tear Down" }
combined_dataset/train/non-malicious/3636.ps1
3636.ps1
function Test-ListServerAdvisors { $rg = Create-ResourceGroupForTest $server = SetupServer $rg try { $response = Get-AzSqlServerAdvisor ` -ResourceGroupName $server.ResourceGroupName ` -ServerName $server.ServerName Assert-NotNull $response ValidateAdvisorCount $response foreach($adv...
combined_dataset/train/non-malicious/2373.ps1
2373.ps1
function Compare-Folder { [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [ValidateScript({ Test-Path -Path $_ -PathType Container })] [string]$ReferenceFolder, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [ValidateScript({ Test-Path -Path $_ -PathType Container })] ...
combined_dataset/train/non-malicious/Start-ComputerJobs.ps1
Start-ComputerJobs.ps1
#requires -version 2.0 function Start-ComputerJobs{ <# .NOTES Name: Start-ComputerJobs Author: Tome Tanasovski Created: 6/25/2010 Version: 1.0 Website: http://powertoe.wordpress.com .SYNOPSIS Multithreads a scriptblock with jobs .DESCRIPTION The St...
combined_dataset/train/non-malicious/Is-Natural.ps1
Is-Natural.ps1
function is-natural{ param ($number) if($number -like "*.*" -or $number -like "*-*"){ return $false }else{return $true} }
combined_dataset/train/non-malicious/UIAutomation _1.6.ps1
UIAutomation _1.6.ps1
## UI Automation v 1.7 -- REQUIRES the Reflection module (current version: http://poshcode.org/2480 ) ## # WASP 2.0 is getting closer, but this is still just a preview: # -- a lot of the commands have weird names still because they're being generated ignorantly # -- eg: Invoke-Toggle.Toggle and Invoke-Invoke.Invo...
combined_dataset/train/non-malicious/Lab Manager Demo.ps1
Lab Manager Demo.ps1
# Demo showing how to connect to VMware Lab Manager. # Download LabManager.ps1 from http://www.poshcode.org/753. . .\\LabManager.ps1 # Run this command if your Lab Manager's certificate is untrusted but you # want to connect. Ignore-SslErrors # Connect to Lab Manager. $labManager = Connect-LabManager -server...
combined_dataset/train/non-malicious/690.ps1
690.ps1
function Backup-RsEncryptionKey { [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] param ( [Parameter(Mandatory = $True)] [string] $Password, [Parameter(Mandatory = $True)] [string] $KeyPath, [Alias('S...
combined_dataset/train/non-malicious/3949.ps1
3949.ps1
function Check-CmdletReturnType { param($cmdletName, $cmdletReturn) $cmdletData = Get-Command $cmdletName; Assert-NotNull $cmdletData; [array]$cmdletReturnTypes = $cmdletData.OutputType.Name | Foreach-Object { return ($_ -replace "Microsoft.Azure.Commands.Network.Models.","") ...
combined_dataset/train/non-malicious/sample_50_94.ps1
sample_50_94.ps1
# Instructions: select the entire file and hit F8 to # load the extensions. To see the list of registered # extensions and run them, hit Ctrl+Shift+P, type 'addi' # and run the "Show additional commands from PowerShell modules" # command. A quick pick list will appear with all 3 # extensions registered. Selecti...
combined_dataset/train/non-malicious/221.ps1
221.ps1
function Get-SCSMWorkItemParent { [CmdletBinding()] PARAM ( [Parameter(ParameterSetName = 'GUID', Mandatory)] [Alias('ID')] $WorkItemGUID, [Parameter(ParameterSetName = 'Object', Mandatory)] $WorkItemObject ) BEGIN { IF (-not (Get-Module -Name Sm...
combined_dataset/train/non-malicious/sample_25_27.ps1
sample_25_27.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/2733.ps1
2733.ps1
[CmdletBinding()] Param ( [Parameter(Mandatory=$false)] [switch]$AllEvents ) if ($AllEvents) { Write-Warning "Running this script in 'AllEvents' mode is not recommended as it returns a significant amount of unnecessary data." Start-Sleep -Seconds 1 Get-WinEvent -LogName "Microsoft-Windows-T...
combined_dataset/train/non-malicious/961.ps1
961.ps1
$rgName='MyResourceGroup' $location='eastus' $cred = Get-Credential -Message 'Enter a username and password for the virtual machine.' New-AzResourceGroup -Name $rgName -Location $location $fesubnet = New-AzVirtualNetworkSubnetConfig -Name 'MySubnet-FrontEnd' -AddressPrefix '10.0.1.0/24' $besubnet = New-AzVirtual...
combined_dataset/train/non-malicious/1422.ps1
1422.ps1
function Install-CMsi { [CmdletBinding(SupportsShouldProcess=$true)] param( [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] [Alias('FullName')] [string[]] $Path, [Parameter(DontShow=$true)] [Switch...
combined_dataset/train/non-malicious/sample_65_88.ps1
sample_65_88.ps1
]Ограничението PrintAllTranslations не може да се използва с ограничението IgnoreTranslations.†Не можете да добавите изчислената колона „%{oii_column/}“ към хибридната таблица „%{oii_table/}“. Моля, премахнете изчислената колона.•Не можете да добавяте колона „alternateOf“, използвана за агрегации, към хибридната табли...
combined_dataset/train/non-malicious/sample_47_62.ps1
sample_47_62.ps1
# # Module manifest for module 'OCI.PSModules.Analytics' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Analytics.dll' # Version number of this module. ModuleVersion = '83.2.0' # Supported PSEditions Co...
combined_dataset/train/non-malicious/sample_51_42.ps1
sample_51_42.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_46_92.ps1
sample_46_92.ps1
# # Module manifest for module 'GCArcService' # # Generated by: Microsoft # # Generated on: 08/09/2020 # @{ # Script module or binary module file associated with this manifest. ModuleToProcess = 'GCArcService.psm1' # Version number of this module. ModuleVersion = '1.0' # ID used to uniquely identify...
combined_dataset/train/non-malicious/Invoke-RemoteCommand_2.ps1
Invoke-RemoteCommand_2.ps1
<# # Script FileName: func_Invoke-RemoteCommand.ps1 # Current Version: A03 # Description: Run command on a remote computer as the currently logged on user. # Created By: Adam Listek # Version Notes # A01 - Initial Release # A02 - Conversion to Function # A03 - Abstracted to generic purpos...
combined_dataset/train/non-malicious/Generate Random Data.ps1
Generate Random Data.ps1
$dictionaryWords = gc $dictionaryFile $azLower = 'abcdefghijklmnopqrstuvwxyz'.ToCharArray() $azUpper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.ToCharArray() $hex = '012345679ABCDEF'.ToCharArray() $digit = '0123456789'.ToCharArray() $alphanumeric = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.ToCharArray()...