full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/Test-VM_1.ps1
Test-VM_1.ps1
Function Test-VM { [cmdletbinding()] Param ( [Parameter(Mandatory=$true,Position=1)] [string[]]$Name, [Parameter(Mandatory=$true,Position=2)] [string[]]$ComputerName ) Process { $results = @() foreach ($cName in $ComputerName) { ...
combined_dataset/train/non-malicious/4456.ps1
4456.ps1
Save-PSResource 'TestModule' Save-PSResource -name 'TestModule' Save-PSResource 'TestModule' -Type 'Module' Save-PSResource 'TestModule' -Type 'Module', 'Script', 'Library' Save-PSResource 'TestModule1', 'TestModule2', 'TestModule3' Save-PSResource 'TestModule' -MinimumVersion '1.5.0' Save-PSResource '...
combined_dataset/train/non-malicious/sample_45_38.ps1
sample_45_38.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 = '73.1.0' # Supported PSEditions Comp...
combined_dataset/train/non-malicious/sample_11_52.ps1
sample_11_52.ps1
# # Module manifest for module 'OCI.PSModules.Fleetsoftwareupdate' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Fleetsoftwareupdate.dll' # Version number of this module. ModuleVersion = '74.1.0' # Sup...
combined_dataset/train/non-malicious/4340.ps1
4340.ps1
function Get-ExportedDscResources { [CmdletBinding(PositionalBinding=$false)] Param ( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [PSModuleInfo] $PSModuleInfo ) $dscResources = @() if(-not $script:IsCoreCLR -and (Get-Command -Name Get-DscResource -Mo...
combined_dataset/train/non-malicious/sample_16_21.ps1
sample_16_21.ps1
# # Module manifest for module 'OCI.PSModules.Databasetools' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Databasetools.dll' # Version number of this module. ModuleVersion = '77.0.0' # Supported PSEdi...
combined_dataset/train/non-malicious/sample_31_9.ps1
sample_31_9.ps1
# # Module manifest for module 'OCI.PSModules.Announcementsservice' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Announcementsservice.dll' # Version number of this module. ModuleVersion = '83.2.0' # S...
combined_dataset/train/non-malicious/Set Active Sync DeviceID_1.ps1
Set Active Sync DeviceID_1.ps1
# Requires a connection to Exchange Server, or Exchange Management Shell $s = New-PSSession -ConfigurationName Microsoft.Exchange -Name ExchMgmt -ConnectionUri http://ex14.domain.local/PowerShell/ -Authentication Kerberos Import-PSSession $s # Get all Client Access Server properties for all mailboxes with an Activ...
combined_dataset/train/non-malicious/sample_53_41.ps1
sample_53_41.ps1
# # Module manifest for module 'OCI.PSModules.Containerinstances' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Containerinstances.dll' # Version number of this module. ModuleVersion = '83.2.0' # Suppo...
combined_dataset/train/non-malicious/3049.ps1
3049.ps1
function Should-FileContentMatch($ActualValue, $ExpectedContent, [switch] $Negate, $Because) { $succeeded = (@(& $SafeCommands['Get-Content'] -Encoding UTF8 $ActualValue) -match $ExpectedContent).Count -gt 0 if ($Negate) { $succeeded = -not $succeeded } $failureMessage = '' if (-not ...
combined_dataset/train/non-malicious/2077.ps1
2077.ps1
Describe 'Positive Parse Properties Tests' -Tags "CI" { It 'PositiveParsePropertiesTest' { class C1 {} class C2 { $x; } class C3 { [int] $x; } class C4 { $x; $y } class C5 { ...
combined_dataset/train/non-malicious/2309.ps1
2309.ps1
[CmdletBinding()] param ( [switch]$Replace, [Parameter(Mandatory)] [ValidateScript({ Test-Path $_ -PathType Leaf })] [string]$CsvFilePath, [Parameter(Mandatory)] [string]$ServerInstance, [Parameter(Mandatory)] [string]$Database, [string]$Schema = 'dbo', [Parameter(Mandatory)] [string]$Table ) begin { $E...
combined_dataset/train/non-malicious/Test-CommandValidation.ps1
Test-CommandValidation.ps1
############################################################# # # PS II> Test-CommandValidation -command get-process | fl # VerbNounConvention : True # ReservedKeyWords : True # VerbConvention : True # # author: Walid Toumi ################################################...
combined_dataset/train/non-malicious/1657.ps1
1657.ps1
function Enable-PSRemoting { param ( [string[]]$Computers = (Read-Host 'Enter computer name'), [switch]$ShowSkipped ) if (!$Computers) {Throw 'No computer name entered.'} $services = 'WinRM', 'RasAuto', 'RpcLocator', 'RemoteRegistry', 'RemoteAccess' $skipped = @() ...
combined_dataset/train/non-malicious/372.ps1
372.ps1
function Complete { [CmdletBinding()] param ( [string] $Expression ) process { [System.Management.Automation.CommandCompletion]::CompleteInput( $Expression, $Expression.Length, $null ).CompletionMatches } } Describe 'Completion tests: Tepp System' { function Get-Alcohol { [CmdletBinding()]...
combined_dataset/train/non-malicious/3537.ps1
3537.ps1
$location = "southeastasia" $resourceGroupName = "pstestFSRG1bca8f8e" $vaultName = "PSTestFSRSV1bca8f8e" $fileShareFriendlyName = "pstestfs1bca8f8e" $fileShareName = "AzureFileShare;pstestfs1bca8f8e" $saName = "pstestsa1bca8f8e" $skuName="Standard_LRS" $newPolicyName = "newFilePolicy" functio...
combined_dataset/train/non-malicious/sample_47_22.ps1
sample_47_22.ps1
# # Module manifest for module 'OCI.PSModules.Cloudbridge' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Cloudbridge.dll' # Version number of this module. ModuleVersion = '79.0.0' # Supported PSEdition...
combined_dataset/train/non-malicious/2238.ps1
2238.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true, HelpMessage="Computer name of the system being deployed")] [ValidateNotNullorEmpty()] [string]$ComputerName, [parameter(Mandatory=$true, HelpMessage="Path to the MDT Deployment Share with monitoring enabled")] [Validate...
combined_dataset/train/non-malicious/sample_1_27.ps1
sample_1_27.ps1
ConvertFrom-StringData @' id_dpm_getsysinfo_activity=Gathering system information id_dpm_status_getsysinfo=Running DC_GetSystemInfo.ps1 '@ # SIG # Begin signature block # MIIoRgYJKoZIhvcNAQcCoIIoNzCCKDMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQ...
combined_dataset/train/non-malicious/sample_51_18.ps1
sample_51_18.ps1
# # Module manifest for diagnostics for network controller # # Copyright="© Microsoft Corporation. All rights reserved." # @{ # ID used to uniquely identify this module GUID = 'd6df305a-d5c8-4ad6-9161-5ee6ba44b501' # Author of this module Author = 'Microsoft Corporation' # Company or vendor of this mo...
combined_dataset/train/non-malicious/2780.ps1
2780.ps1
Param( [Parameter(Mandatory=$False,Position=0)] [switch]$NoStacking=$False ) function Get-Median { Param( [Parameter(Mandatory=$True,Position=0)] [double[]]$Data ) $Data = $Data | Sort-Object if ($Data.Count%2) { $Median = $Data[[Math]::Floor($Data.Co...
combined_dataset/train/non-malicious/2155.ps1
2155.ps1
Describe "Verify Markdown Links" { BeforeAll { if(!(Get-Command -Name 'markdown-link-check' -ErrorAction SilentlyContinue)) { Write-Verbose "installing markdown-link-check ..." -Verbose start-nativeExecution { sudo yarn global add markdown-link-check@3.7.2 ...
combined_dataset/train/non-malicious/3169.ps1
3169.ps1
function Invoke-AzureRmVmScript { [cmdletbinding()] param( [Parameter(Mandatory = $True, Position = 0, ValueFromPipelineByPropertyName = $True)] [string[]]$ResourceGroupName, [Parameter(Mandatory = $True, Posit...
combined_dataset/train/non-malicious/11.ps1
11.ps1
function private:Get-TortoiseGitPath { if ((Test-Path "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe") -eq $true) { return "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" } return "C:\Program Files\TortoiseGit\bin\TortoiseProc.exe" } $Global:TortoiseGitSettings = new-objec...
combined_dataset/train/non-malicious/sample_30_51.ps1
sample_30_51.ps1
# # Module manifest for module 'OCI.PSModules.Servicemanagerproxy' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Servicemanagerproxy.dll' # Version number of this module. ModuleVersion = '82.0.0' # Sup...
combined_dataset/train/non-malicious/2226.ps1
2226.ps1
[CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true,HelpMessage="Site Server where SQL Server Reporting Services are installed")] [ValidateScript({Test-Connection -ComputerName $_ -Count 1})] [string]$ReportServer, [parameter(Mandatory=$true,HelpMessage="SiteCode of the Repor...
combined_dataset/train/non-malicious/3990.ps1
3990.ps1
function NetworkRuleSetTests { $location = Get-Location $resourceGroupName = getAssetName "RSG" $namespaceName = getAssetName "ServiceBus-Namespace-" $namespaceName2 = getAssetName "ServiceBus-Namespace2-" New-AzResourceGroup -Name $resourceGroupName -Location $loc...
combined_dataset/train/non-malicious/RoboCopyWrapper.ps1
RoboCopyWrapper.ps1
# Robocopy example code for more info see the series on my blog # http://thepowershellguy.com/blogs/posh/archive/tags/robocopy/default.aspx ############################################################################################# ## Make RoboCopy Help Object ##################################################...
combined_dataset/train/non-malicious/sample_37_2.ps1
sample_37_2.ps1
ConvertFrom-StringData @' EditorCommandExists=Editor command '{0}' already exists, skipping. EditorCommandImporting=Importing editor command '{0}'. MissingEditorContext=Unable to obtain editor context. Make sure PowerShell Editor Services is running and then try the command again. '@ # SIG # Begin signature bloc...
combined_dataset/train/non-malicious/3630.ps1
3630.ps1
function Test-Capabilities { $location = "eastus" $all = Get-AzSqlCapability $location Validate-Capabilities $all $default = Get-AzSqlCapability $location -Defaults Validate-Capabilities $default $version = Get-AzSqlCapability $location -ServerVersionName "12.0" Validate-Capabilities $default ...
combined_dataset/train/non-malicious/244.ps1
244.ps1
function Get-BatteryStatus { PARAM() try { Add-Type -Assembly System.Windows.Forms [System.Windows.Forms.SystemInformation]::PowerStatus } catch { $PSCmdlet.ThrowTerminatingError($_) } }
combined_dataset/train/non-malicious/3067.ps1
3067.ps1
Set-StrictMode -Version Latest InModuleScope Pester { Describe "Should -BeOfType" { It "passes if value is of the expected type" { 1 | Should BeOfType Int 2.0 | Should BeOfType ([double]) 1 | Should -BeOfType Int 2.0 | Should -BeOfType ([double]) } ...
combined_dataset/train/non-malicious/sample_21_98.ps1
sample_21_98.ps1
ConvertFrom-StringData @' IPAddressDisplayNameFormat=Endereço IP: {0} NetworkNameDisplayNameFormat=Nome: {0} NetworkNameOfflineDisplayNameFormat=Endereço IP: Endereço em "{0}" CreateClusterProgressValidationStart=A validar adequação dos servidores para um cluster de ativação pós-falha. CreateClusterProgressValidat...
combined_dataset/train/non-malicious/sample_65_29.ps1
sample_65_29.ps1
# # Module manifest for module 'OCI.PSModules.Keymanagement' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Keymanagement.dll' # Version number of this module. ModuleVersion = '83.3.0' # Supported PSEdi...
combined_dataset/train/non-malicious/Get-FailingDrive_1.ps1
Get-FailingDrive_1.ps1
Function Get-FailingDrive { <# .SYNOPSIS Checks for any potentially failing drives and reports back drive information. .DESCRIPTION Checks for any potentially failing drives and reports back drive information. This only works against local hard drives using SMART technology. Reason values and th...
combined_dataset/train/non-malicious/sample_34_59.ps1
sample_34_59.ps1
<################################################### # # # Copyright (c) Microsoft. All rights reserved. # # # ##################################################> # Creates remote session to the JEA endpoint. #...
combined_dataset/train/non-malicious/sample_32_91.ps1
sample_32_91.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/Test-VmMigration.ps1
Test-VmMigration.ps1
$vv = get-vm testsql17b | get-view $si = Get-View ServiceInstance -Server $global:DefaultVIServers[1] $hs = get-vmhost infesx52* $hv = $hs | Get-View $pool = $vv.ResourcePool $vmMoRef = $vv.MoRef $hsMoRef = $hv.MoRef $si = Get-View ServiceInstance -Server $global:DefaultVIServers[1] # this turned out to be futil...
combined_dataset/train/non-malicious/sample_45_9.ps1
sample_45_9.ps1
## Copyright (c) Microsoft Corporation. All rights reserved. <# .SYNOPSIS This cmdlet collects a performance recording of Microsoft Defender Antivirus scans. .DESCRIPTION This cmdlet collects a performance recording of Microsoft Defender Antivirus scans. These performance recordings contain Microsoft-Antimal...
combined_dataset/train/non-malicious/sample_20_42.ps1
sample_20_42.ps1
Param ( [Parameter(Mandatory=$true)][string]$installDir, [Parameter(Mandatory=$true)][string]$linkTargetVersion, [Parameter(Mandatory=$true)][string]$latestLinkDir ) $linkName = "latest" if ( Test-Path "$installDir/$latestLinkDir" ){ cd "$installDir/$latestLinkDir" $newTarget = Get-ChildItem -...
combined_dataset/train/non-malicious/1786.ps1
1786.ps1
Describe "Get-ItemProperty" -Tags "CI" { $currentDirectory = Split-Path $PSScriptRoot -Leaf $parentDirectory = Split-Path (Join-Path -Path $PSScriptRoot -ChildPath "..") -Leaf $tempDirectory = $TestDrive $testprovider = (Get-Item $tempDirectory).PSDrive.Name $testfile = Join-Path -Path $tempDire...
combined_dataset/train/non-malicious/New-IseFile.ps1
New-IseFile.ps1
function New-IseFile ($path = 'tmp_default.ps1') { $count = $psise.CurrentPowerShellTab.Files.count $null = $psIse.CurrentPowerShellTab.Files.Add() $Newfile = $psIse.CurrentPowerShellTab.Files[$count] $NewFile.SaveAs($path) $NewFile.Save([Text.Encoding]::default) $Newfile }
combined_dataset/train/non-malicious/sample_13_61.ps1
sample_13_61.ps1
@{ GUID="56D66100-99A0-4FFC-A12D-EEE9A6718AEF" Author="PowerShell" CompanyName="Microsoft Corporation" Copyright="Copyright (c) Microsoft Corporation." ModuleVersion="7.0.0.0" CompatiblePSEditions = @("Core") PowerShellVersion="3.0" FunctionsToExport = @() CmdletsToExport="Start-Transcript", "Stop-Transcript" AliasesTo...
combined_dataset/train/non-malicious/sample_21_22.ps1
sample_21_22.ps1
# # Module manifest for module 'OCI.PSModules.Loggingsearch' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Loggingsearch.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEdi...
combined_dataset/train/non-malicious/2774.ps1
2774.ps1
[CmdletBinding()] Param( [Parameter(Mandatory=$False,Position=0)] [String]$ModulePath="Modules\", [Parameter(Mandatory=$False,Position=1)] [String]$TargetList=$Null, [Parameter(Mandatory=$False,Position=2)] [String]$Target=$Null, [Parameter(Mandatory=$False,Position=3)] ...
combined_dataset/train/non-malicious/438.ps1
438.ps1
$registrationEvent = { } $begin_event = { if (-not (Get-Module -Name 'PSGELF')) { Import-Module -Name 'PSGELF' } } $start_event = { $gelf_gelfserver = Get-PSFConfigValue -FullName 'PSFramework.Logging.GELF.GelfServer' $gelf_port = Get-PSFConfigValue -FullName 'PSFramework.Logging.GELF.Por...
combined_dataset/train/non-malicious/1935.ps1
1935.ps1
Describe "Compare-Object" -Tags "CI" { BeforeAll { $nl = [Environment]::NewLine $content1 = "line 1" + $nl + "line 2" $content2 = "line 1" + $nl + "line 2.1" $content3 = "line 1" + $nl + "line 2" + $nl + "line 3" $content4 = "line 1" + $nl + "line 2.1" + $nl + "Line 3" $file1 = Join-Path -Path $TestDri...
combined_dataset/train/non-malicious/sample_42_75.ps1
sample_42_75.ps1
param() if (Get-Module posh-vcpkg) { return } if ($PSVersionTable.PSVersion.Major -lt 5) { Write-Warning ("posh-vcpkg does not support PowerShell versions before 5.0.") return } if (Test-Path Function:\TabExpansion) { Rename-Item Function:\TabExpansion VcpkgTabExpansionBackup } function Tab...
combined_dataset/train/non-malicious/4038.ps1
4038.ps1
function Test-OriginGetSetWithRunningEndpoint { $profileName = getAssetName $resourceGroup = TestSetup-CreateResourceGroup $resourceLocation = "EastUS" $profileSku = "Standard_Verizon" $createdProfile = New-AzCdnProfile -ProfileName $profileName -ResourceGroupName $resourceGroup.Resou...
combined_dataset/train/non-malicious/sample_60_47.ps1
sample_60_47.ps1
# # Module manifest for module 'OCI.PSModules.Autoscaling' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Autoscaling.dll' # Version number of this module. ModuleVersion = '85.2.0' # Supported PSEdition...
combined_dataset/train/non-malicious/ConvertTo-MultiArray.ps1
ConvertTo-MultiArray.ps1
function ConvertTo-MultiArray { <# .Notes NAME: ConvertTo-MultiArray AUTHOR: Tome Tanasovski Website: http://powertoe.wordpress.com Twitter: http://twitter.com/toenuff Version: 1.0 CREATED: 11/5/2010 LASTEDIT: 11/5/2010 1.0 Initial Release .Synopsis Converts a collection of PowerShell obj...
combined_dataset/train/non-malicious/sample_56_78.ps1
sample_56_78.ps1
# # Module manifest for module 'Az.Relay' # # Generated by: Microsoft Corporation # # Generated on: 23/04/2024 # @{ # Script module or binary module file associated with this manifest. RootModule = 'Az.Relay.psm1' # Version number of this module. ModuleVersion = '2.0.1' # Supported PSEditions Compa...
combined_dataset/train/non-malicious/sample_22_14.ps1
sample_22_14.ps1
# # This private script adds $InterfaceType members to $psObject which invokes on $wrappedObject # Param( $psObject, $wrappedObject, [Type]$InterfaceType ) function GetInvoker { Param( $Target, $Method ) if ($Method.IsGenericMethodDefinition) { return {...
combined_dataset/train/non-malicious/MIFParser.ps1
MIFParser.ps1
param ($fileName, $computerName=$env:ComputerName) ####################### function ConvertTo-MIFXml { param ($mifFile) $mifText = gc $mifFile | #Remove illegal XML characters % { $_ -replace "&", "&amp;" } | % { $_ -replace"'", "&apos;" } | % { $_ -replace "<", "&lt;" } | % {...
combined_dataset/train/non-malicious/sample_62_62.ps1
sample_62_62.ps1
# # Module manifest for module 'OCI.PSModules.Identitydomains' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Identitydomains.dll' # Version number of this module. ModuleVersion = '83.3.0' # Supported P...
combined_dataset/train/non-malicious/sample_5_45.ps1
sample_5_45.ps1
ConvertFrom-StringData @' id_veritasvxiobadconfigflags_sd=VXIO device has a bad state flag and this may cause shadown copies of Veritas volumes to fail. '@ # SIG # Begin signature block # MIIoVQYJKoZIhvcNAQcCoIIoRjCCKEICAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE...
combined_dataset/train/non-malicious/sample_55_79.ps1
sample_55_79.ps1
ZНевозможно выполнить метод, если хранилище с несколькими моментальными снимками отключено.’Запрос был ограничен из-за слишком большого числа инициированных пользователем запросов на обновление источника данных за короткий период времени.gНедостаточно разрешений для обновления таблицы Direct Lake. Обратитесь к создател...
combined_dataset/train/non-malicious/sample_18_60.ps1
sample_18_60.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apa...
combined_dataset/train/non-malicious/Expand-ZipFile.ps1
Expand-ZipFile.ps1
function Expand-ZipFile { param { $zipPath, $destination, [switch] $quiet } $shellApplication = new-object -com shell.application $zipPackage = $shellApplication.NameSpace($zipPath) $destinationFolder = $shellApplication.NameSpace($destination) # CopyHere vOpti...
combined_dataset/train/non-malicious/49.ps1
49.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_26_26.ps1
sample_26_26.ps1
############################ version information begin ####################################### # Script "cru.ps1" # current status: version, v2.0 # cru.ps1 release from: 26.02.2018 ############################ version information end ####################################### #region ############ reading script p...
combined_dataset/train/non-malicious/ConvertTo-Function.ps1
ConvertTo-Function.ps1
## ConvertTo-Function ## By Steven Murawski (http://www.mindofroot.com / http://blog.usepowershell.com) ################################################################################################### ## Usage: ## ./ConvertTo-Function Get-Server.ps1 ## dir *.ps1 | ./convertto-Function ########################...
combined_dataset/train/non-malicious/sample_25_36.ps1
sample_25_36.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/whoami_3.ps1
whoami_3.ps1
function Get-UserStatus { <# .Synopsis Get extended information about local user. .Description There is no input arguments, just specify Get-UserStatus or his alias whoami. .Link http://msdn.microsoft.com/en-us/library/system.security.principal.aspx http://poshcode....
combined_dataset/train/non-malicious/sample_45_67.ps1
sample_45_67.ps1
# region Generated # Load the private module dll $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Dns.private.dll') # Load the internal module $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Dns.internal.psm1' if(Test-Path $internalModulePath) { $null = Impo...
combined_dataset/train/non-malicious/sample_36_13.ps1
sample_36_13.ps1
# Inspired by https://eslint.org/docs/rules/brace-style#stroustrup @{ IncludeRules = @( 'PSPlaceOpenBrace', 'PSPlaceCloseBrace', 'PSUseConsistentWhitespace', 'PSUseConsistentIndentation', 'PSAlignAssignmentStatement', 'PSUseCorrectCasing' ) Rules = @{ ...
combined_dataset/train/non-malicious/sample_36_3.ps1
sample_36_3.ps1
# # Module manifest for module 'OCI.PSModules.Apmsynthetics' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Apmsynthetics.dll' # Version number of this module. ModuleVersion = '80.0.0' # Supported PSEdi...
combined_dataset/train/non-malicious/4276.ps1
4276.ps1
function Get-LAPSPasswords { [CmdletBinding()] Param( [Parameter(Mandatory=$false, HelpMessage="Credentials to use when connecting to a Domain Controller.")] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()]$Credential = [System.Manageme...
combined_dataset/train/non-malicious/sample_37_69.ps1
sample_37_69.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 # MIInwAYJKoZIhvcNAQcCoIInsTCCJ60CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3Ag...
combined_dataset/train/non-malicious/sample_65_16.ps1
sample_65_16.ps1
<################################################### # # # Copyright (c) Microsoft. All rights reserved. # # # ##################################################> $ErrorActionPreference = 'Stop' $observabilityNuget...
combined_dataset/train/non-malicious/Invoke-ScriptBlockClosur.ps1
Invoke-ScriptBlockClosur.ps1
##############################################################################\n##\n## Invoke-ScriptBlockClosure\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...
combined_dataset/train/non-malicious/sample_3_80.ps1
sample_3_80.ps1
@{ GUID = "1DA87E53-152B-403E-98DC-74D7B4D63D59" Author = "PowerShell" CompanyName = "Microsoft Corporation" Copyright = "Copyright (c) Microsoft Corporation." ModuleVersion = "7.0.0.0" CompatiblePSEditions = @("Core") PowerShellVersion = "3.0" CmdletsToExport = @( 'Export-Alias', 'Get-Alias', 'Import-Alias', 'New-Al...
combined_dataset/train/non-malicious/sample_36_27.ps1
sample_36_27.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_27_15.ps1
sample_27_15.ps1
# # Module manifest for module 'OCI.PSModules.Databasemigration' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Databasemigration.dll' # Version number of this module. ModuleVersion = '74.1.0' # Support...
combined_dataset/train/non-malicious/sample_11_81.ps1
sample_11_81.ps1
# # Module manifest for module 'OCI.PSModules.Apmconfig' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Apmconfig.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEditions Co...
combined_dataset/train/non-malicious/sample_51_4.ps1
sample_51_4.ps1
######################################################################################### # # Copyright (c) Microsoft Corporation. All rights reserved. # # Extension Tools # #Requires -Version 4.0 # ######################################################################################### add-type @" usi...
combined_dataset/train/non-malicious/Get-NaCifs.ps1
Get-NaCifs.ps1
# Glenn Sizemore www . Get-Admin . Com # Requires the NetApp OnTap SDK v3.5 # # Will connect to the destination Filer and retrieve detailed information on every # Cifs share. This function will not retrieve permissions. # # Usage: # Connect to the filler # $Filer = 'TOASTER' # $NetApp = New-Object NetApp.Mana...
combined_dataset/train/non-malicious/Findup_5.ps1
Findup_5.ps1
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Security.Cryptography; using System.Runtime.InteropServices; using Microsoft.Win32; using System.IO; namespace Findup { public class FileInfoExt { public FileInfoExt(FileInfo fi) ...
combined_dataset/train/non-malicious/sample_10_15.ps1
sample_10_15.ps1
#************************************************ # TS_WMIHandleLeakKB2639077.ps1 # Version 1.0.1 # Date: 7/19/2013 # Author: v-kaw # Description: [KSE Rule] [ Windows V3] Handle leak in Svchost.exe when a WMI query is triggered by using the Win32_PowerSettingCapabilities # Rule number: 5c139a00-370c-4d1c-a929-...
combined_dataset/train/non-malicious/sample_12_16.ps1
sample_12_16.ps1
ConvertFrom-StringData @' id_ctstcpip=TCPIP id_ctstcpipdescription=Collects information about TCPIP. '@ # SIG # Begin signature block # MIIoLQYJKoZIhvcNAQcCoIIoHjCCKBoCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlA...
combined_dataset/train/non-malicious/3734.ps1
3734.ps1
function Test-AddEndpoint { $endpointName = getAssetname $resourceGroup = TestSetup-CreateResourceGroup $profileName = getAssetname try { $profile = TestSetup-CreateProfile $profileName $resourceGroup.ResourceGroupName TestSetup-AddEndpoint $endpointName $profile Assert-AreEqual 1 $profile....
combined_dataset/train/non-malicious/623.ps1
623.ps1
param( [string]$Version, [string]$Path, [switch]$Force, $Update, [switch]$Uninstall ) $Configs = @{ Url = "http://sdk-for-net.amazonwebservices.com/latest/AWSToolsAndSDKForNet.msi" Path = "$(Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)\" } $Configs | ForEach-Object{ try{ $_...
combined_dataset/train/non-malicious/Publish-File_1.ps1
Publish-File_1.ps1
# Note that this version will not descend directories. function Publish-File { param ( [parameter( Mandatory = $true, HelpMessage="URL pointing to a SharePoint document library (omit the '/forms/default.aspx' portion)." )] [System.Uri]$Url, [system.Management.Automation.PSCredential]$Credential, [paramet...
combined_dataset/train/non-malicious/2458.ps1
2458.ps1
function Set-Example { [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateScript({ Test-Path -Path $_ })] [string]$Path, [Parameter(Mandatory)] [string]$Identity ) DynamicParam { $ParamOptions = @( @{ 'Name' = 'Right'; 'Mandatory' = $true; 'ValidateSetOptions' = ([System.Security.Acces...
combined_dataset/train/non-malicious/sample_54_1.ps1
sample_54_1.ps1
# Import the helper functions Import-Module $PSScriptRoot\..\..\Misc\helper.psm1 -Verbose:$false function Get-TargetResource { [CmdletBinding()] [OutputType([System.Collections.Hashtable])] param ( [parameter(Mandatory = $true)] [System.String] $Category ) #Write-Verbose "Use this cmdlet t...
combined_dataset/train/non-malicious/sample_27_91.ps1
sample_27_91.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/3727.ps1
3727.ps1
function Get-TestResourceGroupName($action) { return "pstestrg" + $action } function Get-TestActionRuleName($action) { return "pstestar" + $action } function Get-ProviderLocation($provider) { "eastus" } function CleanUp($rgname, $actionRuleName) { if ([Microsoft.Azure.Test.Http...
combined_dataset/train/non-malicious/sample_48_90.ps1
sample_48_90.ps1
##------------------------------------------------------------------ ## <copyright file="GetTelemetryStatusAndEditConfigs.ps1" company="Microsoft"> ## Copyright (C) Microsoft. All rights reserved. ## </copyright> ##------------------------------------------------------------------ Param ( [Parameter(Ma...
combined_dataset/train/non-malicious/3080.ps1
3080.ps1
$global:ValidatorRoot = Split-Path $MyInvocation.MyCommand.Path BeforeEachFeature { New-Module -Name ValidatorTestEs { . $global:ValidatorRoot\ValidatorEs.ps1 -Verbose } | Import-Module -Global } AfterEachFeature { Remove-Module ValidatorTestEs } Given 'MiValidator finge devolver True' { Mock...
combined_dataset/train/non-malicious/e17dfa3f-0ecd-4124-a650-54cdf6ae6041.ps1
e17dfa3f-0ecd-4124-a650-54cdf6ae6041.ps1
Get-WmiObject -Class Win32_MountPoint | where {$_.Directory -like ‘Win32_Directory.Name="D:\\\\MDBDATA*"’} | foreach { $vol = $_.Volume Get-WmiObject -Class Win32_Volume | where {$_.__RELPATH -eq $vol} | Select @{Name="Folder"; Expression={$_.Caption}}, @{Name="Server"; Expression={$_.SystemName}...
combined_dataset/train/non-malicious/Shaped WPF Windows.ps1
Shaped WPF Windows.ps1
$window = show -minw 300 -minh 300 -width 400 -height 400 -AllowsTransparency -WindowStyle none -Background transparent { grid { viewbox -stretch Uniform { Path -Fill "#80D0E0FF" -stroke red -strokethickness 4 ` -horizontalalign center -verticalalign center ` -data...
combined_dataset/train/non-malicious/sample_14_47.ps1
sample_14_47.ps1
# Disable CI triggers, only called using Maestro trigger: none variables: - group: Mirror-Credentials - template: /eng/common/templates/variables/pool-providers.yml # Merges code from GitHub into internal branches in internal repos jobs: - template: /eng/common/templates/jobs/jobs.yml parameters: enableTele...
combined_dataset/train/non-malicious/sample_63_30.ps1
sample_63_30.ps1
#!/usr/bin/env pwsh $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent $exe="" $pathsep=":" $env_node_path=$env:NODE_PATH $new_node_path="E:\艺施胡\alova-devtools\node_modules\.pnpm\typescript@5.4.5\node_modules\typescript\bin\node_modules;E:\艺施胡\alova-devtools\node_modules\.pnpm\typescript@5.4.5\node_modules...
combined_dataset/train/non-malicious/Convert File Encoding.ps1
Convert File Encoding.ps1
cd c:\\windows\\temp\\common foreach($File in get-childitem | where-object{($_.Extension -ieq '.PS1') -or ($_.Extension -ieq '.PSM1')}) { $FileName = $File.Name $TempFile = "$($File.Name).ASCII" @@ get-content $FileName | out-file $TempFile -Encoding ASCII remove-item $FileName rename...
combined_dataset/train/non-malicious/1420.ps1
1420.ps1
function Expand-CItem { [OutputType([IO.DirectoryInfo])] [CmdletBinding(SupportsShouldProcess=$true)] param( [Parameter(Mandatory=$true)] [string] $Path, [string] $OutDirectory, [Switch] $Force ) Set-StrictMo...
combined_dataset/train/non-malicious/267.ps1
267.ps1
function Get-SCSMWorkItemUserInput { [CmdletBinding()] Param ( $WorkItemObject ) BEGIN { $userInput = "" $ListArray = @() } PROCESS { $UserInput = $WorkItemObject.UserInput $nl = [Environment]::NewLine $content = [XML]$UserInput $inputs = $content.UserInputs.UserInput foreach ($input in $in...
combined_dataset/train/non-malicious/Set-Computername_10.ps1
Set-Computername_10.ps1
function Set-ComputerName { param( [switch]$help, [string]$originalPCName=$(read-host "Please specify the current name of the computer"), [string]$computerName=$(read-host "Please specify the new name of the computer")) $usage = "set-ComputerName -originalPCname CurrentName -computername AnewName" if (...
combined_dataset/train/non-malicious/2064.ps1
2064.ps1
Describe "Language Primitive Tests" -Tags "CI" { It "Equality comparison with string and non-numeric type should not be culture sensitive" { $date = [datetime]'2005,3,10' $val = [System.Management.Automation.LanguagePrimitives]::Equals($date, "3/10/2005") $val | Should -BeTrue } I...
combined_dataset/train/non-malicious/finddupe_1.ps1
finddupe_1.ps1
param($dir = '.') function Get-MD5([System.IO.FileInfo] $file = $(throw 'Usage: Get-MD5 [System.IO.FileInfo]')) { $stream = $null; $cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider]; $hashAlgorithm = new-object $cryptoServiceProvider $stream = $file.OpenRead(); $h...
combined_dataset/train/non-malicious/sample_26_94.ps1
sample_26_94.ps1
# # Module manifest for module 'Microsoft.Sdn.LogicalNetwork' # @{ # Script module or binary module file associated with this manifest. RootModule = 'Microsoft.Sdn.LogicalNetwork.psm1' # Version number of this module. ModuleVersion = '3.12.0' # Supported PSEditions # CompatiblePSEditions = @() # ID ...