full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
combined_dataset/train/non-malicious/sample_40_58.ps1
sample_40_58.ps1
# # Module manifest for module 'OCI.PSModules.Ons' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Ons.dll' # Version number of this module. ModuleVersion = '82.0.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/3665.ps1
3665.ps1
function Test-CreateUpdateDatabaseReadScale ($serverVersion = "12.0", $location = "Southeast Asia") { $rg = Create-ResourceGroupForTest $server = Create-ServerForTest $rg $location $databaseName1 = Get-DatabaseName $db1 = New-AzSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $s...
combined_dataset/train/non-malicious/sample_60_55.ps1
sample_60_55.ps1
# # Module manifest for module 'OCI.PSModules.Adm' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Adm.dll' # Version number of this module. ModuleVersion = '86.2.0' # Supported PSEditions CompatiblePSEd...
combined_dataset/train/non-malicious/sample_28_88.ps1
sample_28_88.ps1
# Inspired by https://eslint.org/docs/rules/brace-style#stroustrup @{ IncludeRules = @( 'PSPlaceOpenBrace', 'PSPlaceCloseBrace', 'PSUseConsistentWhitespace', 'PSUseConsistentIndentation', 'PSAlignAssignmentStatement', 'PSUseCorrectCasing' ) Rules = @{ ...
combined_dataset/train/non-malicious/Reflection Module.ps1
Reflection Module.ps1
#requires -version 2.0 #History: # 1.0 - First public release (March 19, 2010) # 2.0 - Private Build # - Included the Accelerator function inline # - Added a few default aliases # 3.0 - September 3, 2010 # - Included the New-ConstructorFunction feature (ripped from PowerBoots to serve a more ge...
combined_dataset/train/non-malicious/ESX Lun Latencies.ps1
ESX Lun Latencies.ps1
function Get-VMHostLunLatency { param($VMHost) $luns = $VMHost | Get-ScsiLun foreach ($lun in $luns) { $stats = $VMHost | Get-Stat -stat disk.totalreadlatency.average,disk.totalwritelatency.average -maxsamples 1 -realtime | Where { $_.Instance -eq $Lun.CanonicalName } if ($stats.length -ne $null) ...
combined_dataset/train/non-malicious/2777.ps1
2777.ps1
[CmdletBinding()] Param( [Parameter(Mandatory=$True,Position=0)] [String]$InputFile, [Parameter(Mandatory=$False,Position=1)] [ValidateSet("CSV","JSON","TSV","XML")] [String]$Format="CSV", [Parameter(Mandatory=$True,Position=2)] [String]$Field, [Parameter(Mandatory=$True,P...
combined_dataset/train/non-malicious/sample_1_93.ps1
sample_1_93.ps1
#************************************************ # DC_SummaryReliability.ps1 # Version 0.1 # Date: 3/19/2012 # By Craig Landis (clandis@microsoft.com) #************************************************ # 2023-02-20 WalterE mod Trap #we# trap [Exception]{ WriteTo-StdOut "$($_.InvocationInfo.ScriptName)($($_.Inv...
combined_dataset/train/non-malicious/1766.ps1
1766.ps1
Import-Module HelpersCommon Describe "ExecutionPolicy" -Tags "CI" { Context "Check Get-ExecutionPolicy behavior" { It "Should unrestricted when not on Windows" -Skip:$IsWindows { Get-ExecutionPolicy | Should -Be Unrestricted } It "Should return Microsoft.Powershell.Execu...
combined_dataset/train/non-malicious/DHCP Backup_1.ps1
DHCP Backup_1.ps1
Import-Module ActiveDirectory param ( [Parameter(Position=1)] $searchBase = "cn=configuration,dc=domain,dc=com", [Parameter(Position=2)] $backupDestRoot = "\\\\network\\share\\" ) function Get-OnlineDhcpServers { param ( [Parameter(Mandatory=$true,Position=1)] $dhcpSear...
combined_dataset/train/non-malicious/1091.ps1
1091.ps1
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve) $root = $env:TEMP function Test-ShouldCreateDirectory { $dir = Join-Path -Path $root -ChildPath ([IO.Path]::GetRandomFileName()) Assert-DirectoryDoesNotExist $dir Install-Directory -Path $dir try { ...
combined_dataset/train/non-malicious/1789.ps1
1789.ps1
Describe "Basic FileSystem Provider Tests" -Tags "CI" { BeforeAll { $testDir = "TestDir" $testFile = "TestFile.txt" $restoreLocation = Get-Location } AfterAll { Set-Location -Path $restoreLocation } BeforeEach { Set-Location -Path "TestDrive:\" ...
combined_dataset/train/non-malicious/3056.ps1
3056.ps1
Set-StrictMode -Version Latest InModuleScope Pester { Describe "Should -BeGreaterThan" { It "passes if value greater than expected" { 2 | Should BeGreaterThan 1 2 | Should -BeGreaterThan 1 2 | Should -GT 1 } It "fails if values equal" { { 3 |...
combined_dataset/train/non-malicious/sample_52_55.ps1
sample_52_55.ps1
<############################################################## # # # Copyright (C) Microsoft Corporation. All rights reserved. # # # ##############################################################>...
combined_dataset/train/non-malicious/Find Installed .NET ver.ps1
Find Installed .NET ver.ps1
# Svendsen Tech's .Net version finding script. # See the full documentation at: # http://www.powershelladmin.com/wiki/Script_for_finding_which_dot_net_versions_are_installed_on_remote_workstations param([Parameter(Mandatory=$true)][string[]] $ComputerName, [switch] $Clobber) ##### START OF FUNCTIONS ####...
combined_dataset/train/non-malicious/sample_44_65.ps1
sample_44_65.ps1
# # Module manifest for module 'OCI.PSModules.Genericartifactscontent' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Genericartifactscontent.dll' # Version number of this module. ModuleVersion = '74.1.0...
combined_dataset/train/non-malicious/Get-PSPVersion.ps1
Get-PSPVersion.ps1
$ServerInstance = "YourCMSServerInstance" $query = @" SELECT DISTINCT s.name FROM msdb.dbo.sysmanagement_shared_registered_servers s JOIN msdb.dbo.sysmanagement_shared_server_groups g ON s.server_group_id = g.server_group_id "@ $servers = sqlcmd -S "$ServerInstance" -d "master" -Q "SET NOCOUNT ON; $query" -h -...
combined_dataset/train/non-malicious/1dd696a1-0d97-40cd-9cdf-5cbe5b7fe4a4.ps1
1dd696a1-0d97-40cd-9cdf-5cbe5b7fe4a4.ps1
function Write-Host { <# .SYNOPSIS Replacement of Write-Host function to work around an issue where use of Write-Host can cause an eventual problem with launching EXEs from within the same Powershell session. .DESCRIPTION This Write-Host replacement can act as a temporary wo...
combined_dataset/train/non-malicious/Office 365 wasted Lics.ps1
Office 365 wasted Lics.ps1
$AD = 'C:\\temp\\ad.csv' $o365 = 'C:\\temp\\o365.csv' $duplicates = 'C:\\temp\\Duplicate Office 365 users.csv' $log = 'C:\\temp\\Duplicate Office 365 users.log' $PSEmailServer = 'MAILSERVER' $EmailTo = 'TO-EMAILADDRESS' $EmailFrom = 'FROM-EMAILADDRESS' Import-Module ActiveDirectory Import-Module MSOnline ...
combined_dataset/train/non-malicious/4166.ps1
4166.ps1
[CmdletBinding()] param () Import-Module ActiveDirectory [System.Environment]::SetEnvironmentVariable("EmailAddress", $null, 'User') $EmailAddress = (Get-ADUser $env:USERNAME -Properties mail).mail [System.Environment]::SetEnvironmentVariable("EmailAddress", $EmailAddress, 'User')
combined_dataset/train/non-malicious/3079.ps1
3079.ps1
function MeinValidator($thing_to_validate) { return $thing_to_validate.StartsWith("s") } function Invoke-SomethingThatUsesMeinValidator { param( [ValidateScript( {MeinValidator $_})] $some_param ) }
combined_dataset/train/non-malicious/sample_64_18.ps1
sample_64_18.ps1
Import-Module C:/Users/JakubVanak/Documents/Repos/NaviPartner/np-al-test-runner-fork/PowerShell/ALTestRunner.psm1 -Global Import-Module C:/Users/JakubVanak/Documents/Repos/NaviPartner/np-al-test-runner-fork/PowerShell/NPTestRunner/NPALTestRunner.psm1 -Global function Load-RequiredAssemblies { param ( ...
combined_dataset/train/non-malicious/New-PSOCustomObject.ps1
New-PSOCustomObject.ps1
# References: # http://blogs.msdn.com/powershell/archive/2009/12/05/new-object-psobject-property-hashtable.aspx # http://poshoholic.com/2008/07/03/essential-powershell-name-your-custom-object-types/ # http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/ function New-...
combined_dataset/train/non-malicious/c439471e-f811-4037-9472-dde03db24534.ps1
c439471e-f811-4037-9472-dde03db24534.ps1
$WarningPreference = "SilentlyContinue" $password = Get-Content C:\\securestring.txt | convertto-securestring $username = "PROD\\administrator" $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password $uucenter = "uu-lillebaelt.dk" $totalSize = 0 $sessio...
combined_dataset/train/non-malicious/sample_8_2.ps1
sample_8_2.ps1
#************************************************ # DC_GroupPolicyClient-Component.ps1 # Version 1.0 # Date: 2009 # Author: Boyd Benson (bbenson@microsoft.com) # Description: Collects information about the Group Policy client. # Called from: Main Networking Diag #*************************************************...
combined_dataset/train/non-malicious/sample_64_89.ps1
sample_64_89.ps1
# Localized 06/27/2024 06:02 AM (GMT) 303:7.1.41104 Add-AppDevPackage.psd1 # Culture = "en-US" ConvertFrom-StringData @' ###PSLOC PromptYesString=&Ja PromptNoString=&Nein BundleFound=Bundle gefunden: {0} PackageFound=Paket gefunden: {0} EncryptedBundleFound=Verschlüsseltes Bundle gefunden: {0} EncryptedPackag...
combined_dataset/train/non-malicious/164.ps1
164.ps1
function show-object { param( [Parameter(ValueFromPipeline = $true)] $InputObject ) Set-StrictMode -Version 3 Add-Type -Assembly System.Windows.Forms $rootVariableName = Get-ChildItem variable:\* -Exclude InputObject,Args | Where-Object { $_.Value -and ($_.Value.GetType(...
combined_dataset/train/non-malicious/3344.ps1
3344.ps1
function Set-ScheduledCommand { [PoshBot.BotCommand( Aliases = ('setschedule', 'set-schedule'), Permissions = 'manage-schedules' )] [cmdletbinding()] param( [parameter(Mandatory)] $Bot, [parameter(Mandatory, Position = 0)] [string]$Id, [par...
combined_dataset/train/non-malicious/sample_16_55.ps1
sample_16_55.ps1
<################################################### # # # Copyright (c) Microsoft. All rights reserved. # # # ##################################################> Import-Module $PSScriptRoot\..\..\Common\Network...
combined_dataset/train/non-malicious/sample_21_64.ps1
sample_21_64.ps1
Signature-Version: 1.0 SHA-256-Digest-Manifest-Main-Attributes: 6O7HmBCrTSNxX243vN9FnfZPeGnR4 HdagZa0WCFVhWg= SHA-256-Digest-Manifest: faE7vVn76wTlHYQe073PzMLkMDJfC0DiL3NplDbVdAM= Created-By: 1.8.0_112 (Oracle Corporation) Name: com/microsoft/azure/toolkit/lib/appservice/deploy/FlexFunctionDe ployHandler.html...
combined_dataset/train/non-malicious/sample_20_12.ps1
sample_20_12.ps1
# # Module manifest for module 'OCI.PSModules.Ocicontrolcenter' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Ocicontrolcenter.dll' # Version number of this module. ModuleVersion = '81.0.0' # Supported...
combined_dataset/train/non-malicious/Get-ExchangeDBSizes_3.ps1
Get-ExchangeDBSizes_3.ps1
<# .SYNOPSIS Get-ExchangeDBSizes - Gather data on Exchange 2007 / 2010 Mailbox Databases. .DESCRIPTION Gathers data from Exchange mailbox servers. These data include: Server\\StorageGroup\\Database (2007) or Database (2010), Total Size (in GB) of the disk, Size of the .edb file (in GB), ...
combined_dataset/train/non-malicious/sample_19_3.ps1
sample_19_3.ps1
ConvertFrom-StringData @' id_dfsrcheckrc=Check for DFSR issues id_dfsrcheckpaused=Detect if DFSR is currently paused due to dirty shutdown. id_dfsrcheckpausedinfo=DFSR on the SysVol disk may be paused. Time of detected 2213 event: id_dfsrcheckpausedsd=DFSR may be in a paused state when an Event ID 2213 is logged ...
combined_dataset/train/non-malicious/New-ISEMenu_2.ps1
New-ISEMenu_2.ps1
Import-Module ShowUI Function New-ISEMenu { New-Grid -AllowDrop:$true -Name "ISEAddonCreator" -columns Auto, * -rows Auto,Auto,Auto,*,Auto,Auto -Margin 5 { New-Label -Name Warning -Foreground Red -FontWeight Bold -Column 1 ($target = New-TextBox -Name txtName -Column 1 -Row ($Row=1)) New-Label...
combined_dataset/train/non-malicious/Get-ExcludedCsprojJavasc.ps1
Get-ExcludedCsprojJavasc.ps1
param( $projectDirectoryName = "MyProject" ) $thisDir = Split-Path $MyInvocation.MyCommand.Path $projectDir = "$thisDir/../$projectDirectoryName" $csproj = [xml](cat $projectDir/*.csproj) $csprojScripts = $csproj.Project.ItemGroup.Content.Include | ? {$_ -match '\\.js$'} "$($csprojScripts.length) scrip...
combined_dataset/train/non-malicious/4298.ps1
4298.ps1
$script:IsWindowsOS = (-not (Get-Variable -Name IsWindows -ErrorAction Ignore)) -or $IsWindows $script:HelpContentExtension = ".zip" if ($script:IsWindowsOS) { $script:HelpContentExtension = ".cab" } $script:ExpectedHelpFile = 'PSModule-help.xml' $script:ExpectedHelpInfoFile = 'PowerShellGet_1d73a601-4a6c-43c...
combined_dataset/train/non-malicious/sample_51_21.ps1
sample_51_21.ps1
ConvertFrom-StringData @' EnvironmentErrorAlreadyExists=Une variable d’environnement de ce nom et de ce type existe déjà. EnvironmentErrorDoesNotExists=Aucune variable d’environnement de ce nom et de ce type n'existe. '@ # SIG # Begin signature block # MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5...
combined_dataset/train/non-malicious/sample_17_49.ps1
sample_17_49.ps1
ConvertFrom-StringData @' id_remotedesktoplserverkb2512845_sd=The version of Terminal Services Licensing installed on this computer is incompatible with Windows Server 2008 (or newer) Remote Desktop Services '@ # SIG # Begin signature block # MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgE...
combined_dataset/train/non-malicious/Get-WebFile _1.7.3.ps1
Get-WebFile _1.7.3.ps1
## Get-WebFile (aka wget for PowerShell) ############################################################################################################## ## Downloads a file or page from the web ## History: ## v3.7.3 - Checks to see if URL is formatted properly (contains http or https) ## v3.7.2 - Puts a try-catch b...
combined_dataset/train/non-malicious/2489.ps1
2489.ps1
function Wait-Ping { [CmdletBinding()] [OutputType()] param ( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$ComputerName, [Parameter()] [ValidateNotNullOrEmpty()] [int]$Timeout = 600, [Parameter()] [ValidateNotNullOrEmpty()] [int]$CheckEvery = 10 ) try { $timer = [Diagnos...
combined_dataset/train/non-malicious/Email-ExpiringADAccounts_1.ps1
Email-ExpiringADAccounts_1.ps1
Function GetMsgBody { Write-Output @" <p>Dear $name,</p> Your ABC network account is about to expire.<br/> Please email helpdesk@abc.com or simply hit 'reply', and include the following details to have your account extended.<br/> <br/> Your name:<br/> The department you currently volunteer in:<br/> ...
combined_dataset/train/non-malicious/2621.ps1
2621.ps1
param([string]$DName ,[System.Management.Automation.PSCredential]$DCred ) configuration LabDC{ param( [string[]] $ComputerName = 'localhost' ,[string] $NIC = 'Ethernet 2' ,[string] $DomainName ,[System.Management.Automation.PSCredential] $DomainCred ) Import-Ds...
combined_dataset/train/non-malicious/3533.ps1
3533.ps1
$location = "southeastasia" $resourceGroupName = "pstestFSRG1bca8f8e" $vaultName = "PSTestFSRSV1bca8f8e" $fileShareFriendlyName = "pstestfs1bca8f8e" $fileShareName = "AzureFileShare;pstestfs1bca8f8e" $saName = "pstestsa1bca8f8e" $skuName="Standard_LRS" $policyName = "AFSBackupPolicy" $storageAccountId = "...
combined_dataset/train/non-malicious/Add new smtp_set prmary_1.ps1
Add new smtp_set prmary_1.ps1
#alias,addnewemailaddress import-csv .\\source.csv | foreach { $user = Get-Mailbox $_.alias $user.emailAddresses+= $_.addnewemailaddress $user.primarysmtpaddress = $_.addnewemailaddress Set-Mailbox $user -emailAddresses $user.emailAddresses set-Mailbox $user -PrimarySmtpAddress $user.primarysmtpaddress }
combined_dataset/train/non-malicious/sample_46_60.ps1
sample_46_60.ps1
export function displayLastSelectedItem(id) { var item = document.getElementById(id); var scroll = document.getElementById(id + "-scroll"); if (!!item && !!scroll) { try { // To be optimized (how to detect the end of scroll container?) for (var i = 0; i < 10; i++) { ...
combined_dataset/train/non-malicious/sample_44_54.ps1
sample_44_54.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/sample_23_87.ps1
sample_23_87.ps1
<############################################################## # # # Copyright (C) Microsoft Corporation. All rights reserved. # # # ##############################################################>...
combined_dataset/train/non-malicious/Set-Computername_7.ps1
Set-Computername_7.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/Enable_Disable FusionLog.ps1
Enable_Disable FusionLog.ps1
function global:Enable-FusionLog { Remove-ItemProperty HKLM:Software\\Microsoft\\Fusion -name EnableLog -ErrorAction SilentlyContinue [void](New-ItemProperty HKLM:Software\\Microsoft\\Fusion -name EnableLog -propertyType dword -ErrorAction Stop) Set-ItemProperty HKLM:Software\\Microsoft\\Fusion -...
combined_dataset/train/non-malicious/553.ps1
553.ps1
function Save-SPOFile { [CmdletBinding()] param ( [Parameter(Mandatory=$true, Position=1)] [string]$targetPath, [Parameter(Mandatory=$true, Position=2)] [System.IO.FileInfo]$file ) $targetPath = Join-SPOParts -Separator '/' -Parts $clientContext.Web.ServerRelativeUrl, $targetPath $fs = $file.O...
combined_dataset/train/non-malicious/sample_61_35.ps1
sample_61_35.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_12_7.ps1
sample_12_7.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 = '75.1.0' # Supported P...
combined_dataset/train/non-malicious/sample_66_69.ps1
sample_66_69.ps1
<# .SYNOPSIS NewSelfSignedCertificate.ps1 script file This is a place-holder file only for agent patch build purposes #> Write-Host "This file functionality is deprecated and is place-holder only" # SIG # Begin signature block # MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5Bgor # ...
combined_dataset/train/non-malicious/Interact with in-VM UI.ps1
Interact with in-VM UI.ps1
# First, start asynchronous tools update. We need to do it in a separate process # because the update is a beta version which contains unsigned drivers and will # be blocked by Windows' driver confirmation prompt $updateScript = " Add-PSSnapin VMware.VimAutomation* Connect-VIServer $DefaultVIServer Get-VM 'OldVMT...
combined_dataset/train/non-malicious/2588.ps1
2588.ps1
$dir = dir e:\dexma $dir |ConvertTo-Csv -Delimiter "`t" -NoTypeInformation|out-clipboard $excel = New-Object -ComObject Excel.Application $excel.visible = $true $workbook = $excel.Workbooks.Add() $range = $workbook.ActiveSheet.Range("b5","b$($dir.count + 5)") $workbook.ActiveSheet.Paste($range, $false) $workbook.SaveAs...
combined_dataset/train/non-malicious/sample_38_22.ps1
sample_38_22.ps1
# # Module manifest for module 'OCI.PSModules.Cloudguard' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Cloudguard.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEditions ...
combined_dataset/train/non-malicious/1885.ps1
1885.ps1
Describe "Write-Host with default Console Host" -Tags "Slow","Feature" { BeforeAll { $powershell = Join-Path -Path $PsHome -ChildPath "pwsh" $testData = @( @{ Name = '-Separator'; Command = "Write-Host a,b,c -Separator '+'"; returnCount = 1; returnValue = @("a+b...
combined_dataset/train/non-malicious/864.ps1
864.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests', '' . "$here\$sut" $httpUserPassword = $ENV:HttpPassword $location = $ENV:Location $securePassword = ConvertTo-SecureString $httpUserPassword -AsPlainText -Force $loginCreds = New-Object ...
combined_dataset/train/non-malicious/New-AdUserAccount.ps1
New-AdUserAccount.ps1
function New-AdUserAccount {     param (         [string] $Username = $(throw "Parameter -Username [System.String] is required."),         [string] $Password = $(throw "Parameter -Password [System.String] is required."),         [string] $OrganizationalUnit = "Users",         [string] $DisplayName,         [str...
combined_dataset/train/non-malicious/5d8d9270-3bf2-4dc4-8257-653fd32f8a8c.ps1
5d8d9270-3bf2-4dc4-8257-653fd32f8a8c.ps1
function Set-Domain { param( [switch]$help, [string]$domain=$(read-host "Please specify the domain to join"), [System.Management.Automation.PSCredential]$credential = $(Get-Credential) ) $usage = "`$cred = get-credential `n" $usage += "Set-Domain -domain MyDomain -credential `$cred`n" if ($hel...
combined_dataset/train/non-malicious/Get-GroupMembership_4.ps1
Get-GroupMembership_4.ps1
## Get-DistinguishedName -- look up a DN from a user's (login) name function Get-DistinguishedName { Param($UserName) $ads = New-Object System.DirectoryServices.DirectorySearcher([ADSI]'') $ads.filter = "(&(objectClass=Person)(samAccountName=$UserName))" $s = $ads.FindOne() return $s.GetDirectoryEnt...
combined_dataset/train/non-malicious/2634.ps1
2634.ps1
function Get-FreeDBSpace{ [cmdletbinding()] param([parameter(ValueFromPipeline)][string[]] $InstanceName = 'localhost' ,[switch] $IncludeSystemDBs) BEGIN{ $output = @() } PROCESS{ $smo = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $InstanceName try{ ...
combined_dataset/train/non-malicious/1664.ps1
1664.ps1
function Get-IEVersion ($computer = $env:COMPUTERNAME) { $version = 0 $keyname = 'SOFTWARE\Microsoft\Internet Explorer' $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer) $key = $reg.OpenSubkey($keyname) try { $version = $key.GetValue('Versio...
combined_dataset/train/non-malicious/3765.ps1
3765.ps1
function Test-NewIntegrationAccountBatchConfiguration { $batchConfigurationFilePath = Join-Path (Join-Path $TestOutputRoot "Resources") "SampleBatchConfiguration.json" $batchConfigurationContent = [IO.File]::ReadAllText($batchConfigurationFilePath) $resourceGroup = TestSetup-CreateResourceGroup $inte...
combined_dataset/train/non-malicious/sample_29_31.ps1
sample_29_31.ps1
# Copyright (C) Intel Corporation, 2007 - 2019 All Rights Reserved. Function Clear-AMTAlarmClock { <# .Synopsis Clears Intel Active Management Technology alarm clock timers .Description This CmdLet clears the Intel Active Management Technology (AMT) alarm clock timers from clients that have Intel A...
combined_dataset/train/non-malicious/sample_46_34.ps1
sample_46_34.ps1
##------------------------------------------------------------------ ## <copyright file="ObservabilityDeploymentHelper.psm1" company="Microsoft"> ## Copyright (C) Microsoft. All rights reserved. ## </copyright> ##------------------------------------------------------------------ #region Imports Import-Modu...
combined_dataset/train/non-malicious/sample_2_63.ps1
sample_2_63.ps1
#************************************************ # DC_SmbClient-Component.ps1 # Version 1.1 # Date: 2009-2019 # Author: Boyd Benson (bbenson@microsoft.com) +WalterE # Description: Collects information about the SMB Client. # Called from: Main Networking Diag, etc. #**********************************************...
combined_dataset/train/non-malicious/1413.ps1
1413.ps1
function Install-CRegistryKey { [CmdletBinding(SupportsShouldPRocess=$true)] param( [Parameter(Mandatory=$true)] [string] $Path ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState if( -not...
combined_dataset/train/non-malicious/Pivot-Object_1.ps1
Pivot-Object_1.ps1
#.Synopsis # Pivot multiple objects which are normalized with properties that are name, value pairs. #.Description # Takes a series of objects where there are multiple rows to represent each object, with a pair of columns with the name and value of an additional property, and outputs new objects which have those ...
combined_dataset/train/non-malicious/sample_51_39.ps1
sample_51_39.ps1
<# .Synopsis Short description .DESCRIPTION Long description .EXAMPLE Example of how to use this cmdlet .EXAMPLE Another example of how to use this cmdlet #> function Stop-Process2 { [CmdletBinding(SupportsShouldProcess = $true)] [Alias()] [OutputType([int])] param( # Param1 help description ...
combined_dataset/train/non-malicious/1219.ps1
1219.ps1
& (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-CarbonTest.ps1' -Resolve) $manifest = Test-ModuleManifest -Path (Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon\Carbon.psd1' -Resolve) Describe 'CarbonVersion' { $expectedVersion = $null BeforeEach { } It 'carbon assembl...
combined_dataset/train/non-malicious/sample_0_61.ps1
sample_0_61.ps1
# # Module manifest for module 'OCI.PSModules.Filestorage' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Filestorage.dll' # Version number of this module. ModuleVersion = '93.0.0' # Supported PSEdition...
combined_dataset/train/non-malicious/984.ps1
984.ps1
$RG="AzfwSampleScriptEastUS" $Location="East US" $securePassword = ConvertTo-SecureString 'P@$$W0rd010203' -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential ("AzfwUser", $securePassword) New-AzResourceGroup -Name $RG -Location $Location $VnetName=$RG+"Vnet" New-AzVirtualNetwork -...
combined_dataset/train/non-malicious/sample_23_15.ps1
sample_23_15.ps1
<################################################### # # # Copyright (c) Microsoft. All rights reserved. # # # ##################################################> Import-Module "NetworkControllerRESTWrappers.psm...
combined_dataset/train/non-malicious/sample_58_94.ps1
sample_58_94.ps1
# # Module manifest for module 'OCI.PSModules.Certificatesmanagement' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Certificatesmanagement.dll' # Version number of this module. ModuleVersion = '86.2.0' ...
combined_dataset/train/non-malicious/List AD Users CSV.ps1
List AD Users CSV.ps1
$NumDays = 0 $LogDir = ".\\User-Accounts.csv" $currentDate = [System.DateTime]::Now $currentDateUtc = $currentDate.ToUniversalTime() $lltstamplimit = $currentDateUtc.AddDays(- $NumDays) $lltIntLimit = $lltstampLimit.ToFileTime() $adobjroot = [adsi]'' $objstalesearcher = New-Object System.DirectoryServices.Dire...
combined_dataset/train/non-malicious/2304.ps1
2304.ps1
function Invoke-PasswordRoll { [CmdletBinding(DefaultParameterSetName = "Encryption")] Param ( [Parameter(Mandatory = $true)] [String[]] $ComputerName, [Parameter(Mandatory = $true)] [String[]] $LocalAccounts, [Parameter(Mandatory = $true)] [String] $TsvFileName, [Parameter(ParameterSet...
combined_dataset/train/non-malicious/1615.ps1
1615.ps1
$Dest = "C:\Support\SQLBac\"; $Daysback = "0"; $CurrentDate = Get-Date $DatetoDelete = $CurrentDate.AddDays($Daysback) Get-ChildItem $Dest | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item
combined_dataset/train/non-malicious/sample_47_68.ps1
sample_47_68.ps1
# # Module manifest for module 'OCI.PSModules.Core' # # Generated by: Oracle Cloud Infrastructure # # @{ # Script module or binary module file associated with this manifest. RootModule = 'assemblies/OCI.PSModules.Core.dll' # Version number of this module. ModuleVersion = '74.1.0' # Supported PSEditions CompatiblePS...
combined_dataset/train/non-malicious/sample_63_12.ps1
sample_63_12.ps1
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],(function(e,t,n){"use strict";var r=e("../lib/oop"),a=e("./text_highlight_rules").TextHighlightRules,i=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@\\w+(?=\\s|$)"},i.getTagRu...
combined_dataset/train/non-malicious/Audit Script_3.ps1
Audit Script_3.ps1
##################################################### # # # Audit script by Alan Renouf - Virtu-Al # # Blog: http://teckinfo.blogspot.com/ # # # # Usage: Audit.ps1 'pathtolistofservers' # # # # The file is optional and needs to be a # ...
combined_dataset/train/non-malicious/TabExpansion for V2CTP_8.ps1
TabExpansion for V2CTP_8.ps1
## Tab-Completion ################# ## For V2CTP3. ## This won't work on V1 and V2CTP and V2CTP2. ## Please dot souce this script file. ## In first loading, it may take a several minutes, in order to generate ProgIDs and TypeNames list. ## ## What this can do is: ## ## [datetime]::n<tab> ## [datetime]::now.d...
combined_dataset/train/non-malicious/2576.ps1
2576.ps1
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null function getwmiinfo ($svr) { gwmi -query "select * from Win32_ComputerSystem" -computername $svr | select Name, Model, Manufacturer, DNSHostName, CurrentTimeZone, Domain, NumberOfProcessors, NumberOfLogicalPr...
combined_dataset/train/non-malicious/sample_5_91.ps1
sample_5_91.ps1
#************************************************ # TS_PowerCFG.ps1 # Version 3.0 # Date: 14/03/2013 # Author: v-kaw # Description: Running powercfg.exe to obtain power settings information # Note: This is the third edition of this file. Ideal ID for this edition is 6292. # Ideal ID for second edition is ...
combined_dataset/train/non-malicious/1297.ps1
1297.ps1
function Remove-CRegistryKeyValue { [CmdletBinding(SupportsShouldProcess=$true)] param( [Parameter(Mandatory=$true)] [string] $Path, [Parameter(Mandatory=$true)] [string] $Name ) Set-StrictMode -Version 'Latest' U...
combined_dataset/train/non-malicious/Set-Proxy_1.ps1
Set-Proxy_1.ps1
param( [Parameter(Position=0,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$true)] [alias("Name","ComputerName")] $Computer = @($env:computername), [switch] $ClearProxy ) begin{ $IEsettingsKey = ".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" [array]$ProxyResult = @() f...
combined_dataset/train/non-malicious/sample_9_61.ps1
sample_9_61.ps1
#************************************************ # DC_IPsec-Component.ps1 # Version 1.0 # Version 1.1: Altered the runPS function correctly a column width issue. # Date: 2009-2014 # Author: Boyd Benson (bbenson@microsoft.com) # Description: Collects information about the IPsec component. # Called from: Main Net...
combined_dataset/train/non-malicious/Compare-InstalledHotfix.ps1
Compare-InstalledHotfix.ps1
Function Compare-InstalledHotfix { param ( [parameter(Mandatory=$true,Position=0)] $server1, [parameter(Mandatory=$true,Position=1)] $server2, [parameter(Mandatory=$true,Position=3)] [Management.Automation.PSCredential] $credential ) $server1HotFix = get-hotfix -computer $server1 -Credential $credentia...
combined_dataset/train/non-malicious/sample_50_39.ps1
sample_50_39.ps1
<######################################################################################################### # File: Deploy-Agent.ps1 # # .DESCRIPTION # # Install Azure site recovery agent and register it. It requires two pre-defined variables ($keyContent and $node). # # Copyright (c) Microsoft Corp 2016...
combined_dataset/train/non-malicious/sample_10_33.ps1
sample_10_33.ps1
ConvertFrom-StringData @' id_w32timeoutput=W32Time id_w32timeobtaining=Gathering W32Time information '@ # SIG # Begin signature block # MIIoUQYJKoZIhvcNAQcCoIIoQjCCKD4CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlA...
combined_dataset/train/non-malicious/4258.ps1
4258.ps1
Function Get-RandomName { param ( [int]$Length ) $set = 'abcdefghijklmnopqrstuvwxyz'.ToCharArray() $result = '' for ($x = 0; $x -lt $Length; $x++) {$result += $set | Get-Random} return $result } Function Invoke-WinRMSession { param ( $username, $Password, $IPAddress ) $PSS = Con...
combined_dataset/train/non-malicious/Test-Hash.ps1
Test-Hash.ps1
function Test-Hash { #.Synopsis # Test the HMAC hash(es) of a file #.Description # Takes the HMAC hash of a file using specified algorithm, and optionally, compare it to a baseline hash #.Example # C:\\PS>ls .\\Bin\\Release -recurse | Test-Hash -BasePath .\\Bin\\Release -Type SHA256 | Export-CSV ~\\Hashes....
combined_dataset/train/non-malicious/1399.ps1
1399.ps1
function ConvertTo-CSecurityIdentifier { [CmdletBinding()] param( [Parameter(Mandatory=$true)] $SID ) Set-StrictMode -Version 'Latest' Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState try { if( $SID -is [string] ) ...
combined_dataset/train/non-malicious/sample_4_96.ps1
sample_4_96.ps1
#************************************************ # TS_DetectWeakKeys.ps1 # Version 1.0.1 # Date: 8/6/2012 # Author: tspring # Description: [Idea ID 5009] [Windows] Weak Key Block Detection # Rule number: 5009 # Rule URL: http://sharepoint/sites/rules/Rule Submissions/Forms/DispForm.aspx?ID=5009 # This rule ...
combined_dataset/train/non-malicious/1926.ps1
1926.ps1
Describe "Import-Alias DRT Unit Tests" -Tags "CI" { $testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ImportAliasTestDirectory $aliasFilename = "aliasFilename" $fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $aliasFilename BeforeEach { New-Item -Path $testA...
combined_dataset/train/non-malicious/sample_1_10.ps1
sample_1_10.ps1
ConvertFrom-StringData @' id_powercfg=Obtaining Power Manager Information id_powercfgdesc=Running powercfg.exe to obtain power settings information '@ # SIG # Begin signature block # MIIoUgYJKoZIhvcNAQcCoIIoQzCCKD8CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JN...
combined_dataset/train/non-malicious/sample_19_46.ps1
sample_19_46.ps1
ConvertFrom-StringData @' id_collectactivity=Collecting Basic System Information TXT id_collectingdata=Collecting Basic Data id_formattingdata=Formatting Data id_uacadminmode=Admin Mode id_uacnoprompt=No Prompt id_uacpromptcredentials=Prompt for credentials id_uacpromptconsent=Prompt for consent id_uacpromptcon...
combined_dataset/train/non-malicious/sample_44_11.ps1
sample_44_11.ps1
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. Register-EditorCommand ` -Name 'PowerShellEditorServices.OpenEditorProfile' ` -DisplayName 'Open Editor Profile' ` -SuppressOutput ` -ScriptBlock { param([Microsoft.PowerShell.EditorServices.Extensions.EditorContex...
combined_dataset/train/non-malicious/sample_21_47.ps1
sample_21_47.ps1
##------------------------------------------------------------------ ## <copyright file="StandaloneObservabilityConstants.psm1" company="Microsoft"> ## Copyright (C) Microsoft. All rights reserved. ## </copyright> ##------------------------------------------------------------------ $PipelineConstants = @{ ...
combined_dataset/train/non-malicious/Get MOSS User Profile_1.ps1
Get MOSS User Profile_1.ps1
function Get-UserProfile($accountName) { [reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint") | out-null [reflection.assembly]::LoadWithPartialName("Microsoft.Office.Server") | out-null $upm =[Microsoft.Office.Server.UserProfiles.UserProfileManager]( [Microsoft.Office.Server.ServerContext]::D...