Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Powershell Scripts/Active Directory - Active Users Report.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ param (
[Switch]$ExcludeDisabledUsers = [System.Convert]::ToBoolean($env:excludeDisabledUsersFromReport)
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# Tests for administrative rights which is required to get the last logon date.
function Test-IsElevated {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ param (
[String]$wysiwygCustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# If script form variables are used, replace command line parameters with their value.
if ($env:wysiwygCustomFieldName -and $env:wysiwygCustomFieldName -notlike "null") { $wysiwygCustomField = $env:wysiwygCustomFieldName }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ param (
[String]$WysiwygCustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
function Test-IsElevated {
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ param (
[Switch]$QueryForLastUserLogon
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# CIM timeout
$CIMTimeout = 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ param (
[String]$CustomFieldName
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# If using script form variables, replace command line parameters with the form variables.
if ($env:customFieldName -and $env:customFieldName -notlike "null") { $CustomFieldName = $env:customFieldName }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ param (
[Switch]$NoRestart = [System.Convert]::ToBoolean($env:noRestart)
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
function Get-NinjaProperty {
[CmdletBinding()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ param (
[Switch]$NoRestart = [System.Convert]::ToBoolean($env:noRestart)
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
function Get-NinjaProperty {
[CmdletBinding()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ param (
[Parameter()]
[String]$ExportTXT
)
. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
function Test-IsElevated {
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Audit Autopilot Hardware ID.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ param (
$CustomField = "hardwareid"
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {

if ($env:customFieldName -and $env:customFieldName -notlike "null") { $CustomField = $env:customFieldName }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Audit UAC Level.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ param (
[String]$CustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
if ($env:customFieldName -and $env:customFieldName -notlike "null") { $CustomField = $env:customFieldName }

Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Boot Time Alert.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ param (
[String]$BootCustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
if ($env:bootCustomField -and $env:bootCustomField -notlike "null") {
$BootCustomField = $env:bootCustomField
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Check Battery Health.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ param (
[String]$WYSIWYGCustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# If script form variables are used, replace the commandline parameters with their value.
if ($env:wysiwygCustomFieldName -and $env:wysiwygCustomFieldName -notlike "null") { $WYSIWYGCustomField = $env:wysiwygCustomFieldName }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Check Windows 11 Upgrade Compatibility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ param (
[String]$CustomFieldName
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
if ($env:customFieldName -and $env:customFieldName -notlike "null") { $CustomFieldName = $env:customFieldName }

Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Collect MSSQL Instances.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ param (
[String]$WysiwygCustomFieldName
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
function Test-IsElevated {
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Create New Local User.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ param (
[Switch]$AddToLocalAdminGroup = [System.Convert]::ToBoolean($env:addToLocalAdminGroup)
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# Retrieve script form variables and replace the parameters with them, handling 'null' values.
if ($env:usernameToAdd -and $env:usernameToAdd -notlike "null") { $Username = $env:usernameToAdd }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Create Windows VPN.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ param (
[Parameter()]
[Switch]$SkipSleep
)
. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
Add-Type -AssemblyName System.Drawing

Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Credential Guard Status.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ param (
[string]$TextCustomFieldName
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
if ($env:TextCustomFieldName -and $TextCustomFieldName -ne 'null'){
$TextCustomFieldName = $env:TextCustomFieldName
Expand Down
92 changes: 92 additions & 0 deletions Powershell Scripts/CustomFieldCompatibility.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
if (-not (Get-Command Ninja-Property-Set -ErrorAction SilentlyContinue)) {
if (-not $script:WorkflowCustomFieldStore) {
$script:WorkflowCustomFieldStore = @{}
}

function Get-WorkflowCustomFieldStoreKey {
param(
[Parameter()]
[String]$Name,
[Parameter()]
[String]$DocumentName,
[Parameter()]
[String]$AttributeName
)

if ($AttributeName) {
if ($DocumentName) {
return ("doc:{0}:{1}" -f $DocumentName, $AttributeName)
}

return "doc:$AttributeName"
}

return "field:$Name"
}

function Ninja-Property-Set {
param(
[Parameter(Mandatory = $true)]
[String]$Name,
[Parameter(Mandatory = $true)]
$Value
)

$script:WorkflowCustomFieldStore[(Get-WorkflowCustomFieldStoreKey -Name $Name)] = $Value
$Value
}

function Ninja-Property-Get {
param(
[Parameter(Mandatory = $true)]
[String]$Name
)

$script:WorkflowCustomFieldStore[(Get-WorkflowCustomFieldStoreKey -Name $Name)]
}

function Ninja-Property-Options {
param(
[Parameter(Mandatory = $true)]
[String]$Name
)

@()
}

function Ninja-Property-Docs-Set {
param(
[Parameter(Mandatory = $true)]
[String]$AttributeName,
[Parameter(Mandatory = $true)]
$AttributeValue,
[Parameter()]
[String]$DocumentName
)

$script:WorkflowCustomFieldStore[(Get-WorkflowCustomFieldStoreKey -AttributeName $AttributeName -DocumentName $DocumentName)] = $AttributeValue
$AttributeValue
}

function Ninja-Property-Docs-Get {
param(
[Parameter(Mandatory = $true)]
[String]$AttributeName,
[Parameter()]
[String]$DocumentName
)

$script:WorkflowCustomFieldStore[(Get-WorkflowCustomFieldStoreKey -AttributeName $AttributeName -DocumentName $DocumentName)]
}

function Ninja-Property-Docs-Options {
param(
[Parameter(Mandatory = $true)]
[String]$AttributeName,
[Parameter()]
[String]$DocumentName
)

@()
}
}
2 changes: 2 additions & 0 deletions Powershell Scripts/Deploy Wi-Fi Profile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ param (
[Switch]$Overwrite = [System.Convert]::ToBoolean($env:overwrite)
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# If script form variables are used replace the command line parameters.
if ($env:ssid -and $env:ssid -notlike "null") { $SSID = $env:ssid }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Detect Installed Antivirus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ param (
[String]$DefinitionDateAndStatusCustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# If script form variables are used, replace the command line parameters with their value.
if ($env:daysConsideredOutdated -and $env:daysConsideredOutdated -notlike "null") { $DaysUntilConsideredOutdated = $env:daysConsideredOutdated }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Device Uptime Percentage Monitor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ param (
[Switch]$EstimateUnexpectedShutdown = [System.Convert]::ToBoolean($env:estimateUnexpectedShutdownTime)
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
if ($env:uptimeForThePastXDays -and $env:uptimeForThePastXDays -notlike "null") { $Days = $env:uptimeForThePastXDays }
if ($env:startDay -and $env:startDay -notlike "null") { $StartDay = $env:startDay }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Disk Space Alert.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ param (
[String]$AlertOnlyCustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# If script form variables are used, replace the command line parameters with their value.
if ($env:systemVolumeMinimumPercentageFree) { $SystemVolumeMinFreePercent = $env:systemVolumeMinimumPercentageFree }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Download File From URL.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ param (
[Switch]$Overwrite = [System.Convert]::ToBoolean($env:overwrite)
)
# Helper functions and input validation
. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
function Get-NinjaProperty {
[CmdletBinding()]
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Example - Get Custom Field Value.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ param (
[Switch]$ExcludeDisabledUsers = [System.Convert]::ToBoolean($env:excludeDisabledUsersFromReport)
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# Tests for administrative rights which is required to get the last logon date.
function Test-IsElevated {
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Example - Set a Custom Field.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ param (
[String]$Value
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# Grab parameters from dynamic script variables.
if ($env:customFieldName -and $env:customFieldName -notlike "null") { $CustomFieldName = $env:customFieldName }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Exchange Version Check.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ param (
[String]$CheckboxCustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
function Test-IsElevated {
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Failed Password Attempt Report.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ param (
[String]$WysiwygCustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {

if ($env:usernameToCheck -and $env:usernameToCheck -notlike "null") { $UserName = $env:usernameToCheck }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/File or Folder Exists Alert.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ param (
[String]$CustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# Set parameters using dynamic script variables.
if ($env:searchPath -and $env:searchPath -notlike "null") { $SearchPath = $env:searchPath }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Find Certificate with Thumbprint.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ param (
[string]$CustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
function Test-IsElevated {
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Find File with Extension.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ param (
[Parameter()]
[Switch]$ScanAllDrives = [System.Convert]::ToBoolean($env:scanAllDrives)
)
. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# Set parameters using dynamic script variables.
if ($env:fileExtension -and $env:fileExtension -notlike "null") { $Extensions = $env:fileExtension }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Find Registry Key.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ param (
[Switch]$Value = [System.Convert]::ToBoolean($env:searchForMatchingKeyValues)
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
if ($env:rootKeyToSearch -and $env:rootKeyToSearch -notlike "null") { $RootKey = $env:rootKeyToSearch }
if ($env:searchPath -and $env:searchPath -notlike "null") { $SearchPath = $env:searchPath }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Find Rogue DHCP Servers Using Nmap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ param (
[String]$AllowedServersField = "allowedDHCPServers"
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {

# If script variables are used set them here
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Firewall - Audit Status.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ param (
[Parameter()]
[String]$CustomField
)
. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
# If script form variables are used, replace the command-line parameters with their values.
if ($env:firewallStatusCustomFieldName -and $env:firewallStatusCustomFieldName -notlike "null") { $CustomField = $env:firewallStatusCustomFieldName }
Expand Down
2 changes: 2 additions & 0 deletions Powershell Scripts/Get Device Description.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ param (
[String]$CustomField
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
if ($env:nameOfCustomField -and $env:nameOfCustomField -notlike "null") { $CustomField = $env:nameOfCustomField }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ param (
[String]$CustomField = "screenconnectUrl"
)

. "$PSScriptRoot/CustomFieldCompatibility.ps1"

begin {
if ($env:screenconnectDomain -and $env:screenconnectDomain -notlike "null") { $ScreenConnectDomain = $env:screenconnectDomain }
if ($env:sessionGroup -and $env:sessionGroup -notlike "null") { $SessionGroup = $env:sessionGroup }
Expand Down
Loading