Skip to content
Merged
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
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/use-case-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Use Case Request
about: Eine neue Aktion/Anwendungsfall zur Umsetzung mit ScriptRunner beauftragen.

---

**Primäre Anwendergruppe**
An welche Anwendergruppe soll die Aktion delegiert werden?
- [ ] Help Desk / Service Hotline / First-Level-Support
- [ ] Second-Level-Support
- [ ] Fachbereich
- [ ] Endbenutzer
- [ ] Administratoren

**Kurzbeschreibung**
Eine kurze Erläuterung des gewünschten Anwendungsfalls.

**Skriptparameter**
Eine Auflistung, der erforderlichen Skriptparameter inkl. Beschreibung und Typ.

**Zielsysteme und Credentials**
Auf welchen Zielsystemen und mit welchen Credentials soll der Anwendungsfall ausgeführt werden?

**Voraussetzungen**
Voraussetzungen auf dem Zielsystem / Credentials / Infrastruktur / etc.

**Screenshots**
Screenshots, die helfen den Anwendungsfall genauer zu Beschreiben.

**Weitere Anmerkungen**
148 changes: 148 additions & 0 deletions ActiveDirectory/Computer/Get-ADComputersWithDefinedStatus.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#Requires -Version 4.0
#Requires -Modules ActiveDirectory

<#
.SYNOPSIS
Lists computers where disabled or inactive

.DESCRIPTION

.NOTES
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
The terms of use for ScriptRunner do not apply to this script. In particular, AppSphere AG assumes no liability for the function,
the use and the consequences of the use of this freely available script.
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of AppSphere AG.
© AppSphere AG

.COMPONENT
Requires Module ActiveDirectory

.LINK
https://github.com/scriptrunner/ActionPacks/tree/master/ActiveDirectory/Computers

.Parameter OUPath
Specifies the AD path

.Parameter DomainAccount
Active Directory Credential for remote execution on jumphost without CredSSP

.Parameter Disabled
Shows the disabled computers

.Parameter InActive
Shows the inactive computers

.Parameter DomainName
Name of Active Directory Domain

.Parameter SearchScope
Specifies the scope of an Active Directory search

.Parameter AuthType
Specifies the authentication method to use
#>

param(
[Parameter(Mandatory = $true,ParameterSetName = "Local or Remote DC")]
[Parameter(Mandatory = $true,ParameterSetName = "Remote Jumphost")]
[string]$OUPath,
[Parameter(ParameterSetName = "Local or Remote DC")]
[Parameter(ParameterSetName = "Remote Jumphost")]
[switch]$Disabled,
[Parameter(ParameterSetName = "Local or Remote DC")]
[Parameter(ParameterSetName = "Remote Jumphost")]
[switch]$InActive,
[Parameter(Mandatory = $true,ParameterSetName = "Remote Jumphost")]
[PSCredential]$DomainAccount,
[Parameter(ParameterSetName = "Local or Remote DC")]
[Parameter(ParameterSetName = "Remote Jumphost")]
[string]$DomainName,
[Parameter(ParameterSetName = "Local or Remote DC")]
[Parameter(ParameterSetName = "Remote Jumphost")]
[ValidateSet('Base','OneLevel','SubTree')]
[string]$SearchScope='SubTree',
[Parameter(ParameterSetName = "Local or Remote DC")]
[Parameter(ParameterSetName = "Remote Jumphost")]
[ValidateSet('Basic', 'Negotiate')]
[string]$AuthType="Negotiate"
)

Import-Module ActiveDirectory

#Clear
#$ErrorActionPreference='Stop'
try{
$resultMessage = @()
if($PSCmdlet.ParameterSetName -eq "Remote Jumphost"){
if([System.String]::IsNullOrWhiteSpace($DomainName)){
$Domain = Get-ADDomain -Current LocalComputer -AuthType $AuthType -Credential $DomainAccount -ErrorAction Stop
}
else{
$Domain = Get-ADDomain -Identity $DomainName -AuthType $AuthType -Credential $DomainAccount -ErrorAction Stop
}
if([System.String]::IsNullOrWhiteSpace($OUPath)){
$OUPath = $Domain.DistinguishedName
}
if($Disabled -eq $true){
$computers = Search-ADAccount -Credential $DomainAccount -Server $Domain.PDCEmulator -AuthType $AuthType -AccountDisabled -ComputersOnly `
-SearchBase $OUPath -SearchScope $SearchScope | Select-Object DistinguishedName, SAMAccountName | Sort-Object -Property SAMAccountName
if($computers){
foreach($itm in $computers){
$resultMessage = $resultMessage + ("Disabled: " + $itm.DistinguishedName + ';' +$itm.SamAccountName)
}
$resultMessage = $resultMessage + ''
}
}
if($InActive -eq $true){
$computers = Search-ADAccount -Credential $DomainAccount -Server $Domain.PDCEmulator -AuthType $AuthType -AccountInactive -ComputersOnly `
-SearchBase $OUPath -SearchScope $SearchScope | Select-Object DistinguishedName, SAMAccountName | Sort-Object -Property SAMAccountName
if($computers){
foreach($itm in $computers){
$resultMessage = $resultMessage + ("Inactive: " + $itm.DistinguishedName + ';' +$itm.SamAccountName)
}
}
}
}
else{
if([System.String]::IsNullOrWhiteSpace($DomainName)){
$Domain = Get-ADDomain -Current LocalComputer -AuthType $AuthType -ErrorAction Stop
}
else{
$Domain = Get-ADDomain -Identity $DomainName -AuthType $AuthType -ErrorAction Stop
}
if([System.String]::IsNullOrWhiteSpace($OUPath)){
$OUPath = $Domain.DistinguishedName
}
if($Disabled -eq $true){
$computers = Search-ADAccount -Server $Domain.PDCEmulator -AuthType $AuthType -AccountDisabled -ComputersOnly `
-SearchBase $OUPath -SearchScope $SearchScope | Select-Object DistinguishedName, SAMAccountName | Sort-Object -Property SAMAccountName
if($computers){
foreach($itm in $computers){
$resultMessage = $resultMessage + ("Disabled: " + $itm.DistinguishedName + ';' +$itm.SamAccountName)
}
$resultMessage = $resultMessage + ''
}
}
if($InActive -eq $true){
$computers = Search-ADAccount -Server $Domain.PDCEmulator -AuthType $AuthType -AccountInactive -ComputersOnly `
-SearchBase $OUPath -SearchScope $SearchScope | Select-Object DistinguishedName, SAMAccountName | Sort-Object -Property SAMAccountName
if($computers){
foreach($itm in $computers){
$resultMessage = $resultMessage + ("Inactive: " + $itm.DistinguishedName + ';' +$itm.SamAccountName)
}
}
}
}
if($SRXEnv) {
$SRXEnv.ResultMessage = $resultMessage
}
else{
Write-Output $resultMessage
}
}
catch{
throw
}
finally{
}
Loading