This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright: (c) 2025, Jordan Borean (@jborean93) <jborean93@gmail.com> | |
| # MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
| using namespace System.DirectoryServices | |
| using namespace System.Formats.Asn1 | |
| using namespace System.Management.Automation | |
| using namespace System.Numerics | |
| using namespace System.Security.Cryptography.X509Certificates | |
| Function Get-CertificateTemplateInformation { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| rem ******************************************************************************************* | |
| rem ********************** Ввод первоначальных данных ***************************************** | |
| rem ******************************************************************************************* | |
| mode con: cp select=1251 | |
| rem Переменная пути, где будут сохраняться выгрузки из баз | |
| rem Можно указать через ; несколько путей, в конце обязательно\ | |
| set patharcall=D:\ARC\;E:\ARC\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Server 2025 fails to run Get-AppxPackage and other DISM module commands in | |
| # a PSRemoting (psrp) session as it has a dependency on some dll's not present | |
| # in the GAC and only in the powershell.exe directory. As PSRP runs through | |
| # wsmprovhost.exe, it fails to find those dlls. This hack will manually load | |
| # the 4 required dlls into the GAC. This is a hack and should be removed in the | |
| # future if MS fix their bug on 2025. | |
| Add-Type -AssemblyName "System.EnterpriseServices" | |
| $publish = [System.EnterpriseServices.Internal.Publish]::new() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| Define an object that encapsulates how a set of objects interact. | |
| Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently. | |
| #> | |
| class ChatMediator { | |
| $users | |
| ChatMediator() { | |
| $this.users = New-Object System.Collections.ArrayList |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ReportTemplate { | |
| hidden $data | |
| GenerateReport() { | |
| $this.RetrieveFinancialData() | |
| $this.FormatReport() | |
| $this.SendToStakeholders() | |
| } | |
| RetrieveFinancialData() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Command { | |
| execute() { | |
| "[$(get-date)] Logging execute of command [$this]" | Out-Host # Logs the execution of the command | |
| } | |
| } | |
| class Loony : Command { | |
| execute() { | |
| ([Command]$this).execute() # Calls the execute method of the base class (Command) | |
| "You're a loony." | Out-Host # Outputs "You're a loony." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Logger { | |
| log($message) { # Define a method called "log" that takes a message as input | |
| $message | Out-Host # Output the message to the console | |
| } | |
| } | |
| class TimeStampingLogger : Logger { # Define a class called "TimeStampingLogger" that inherits from "Logger" | |
| $logger # Declare a variable called "logger" | |
| TimeStampingLogger($logger) { # Define a constructor that takes a "logger" as input |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Subject { | |
| hidden [System.Collections.ArrayList]$observers | |
| Subject() { | |
| $this.observers = New-Object System.Collections.ArrayList | |
| } | |
| Attach([Observer]$o) { $this.observers.Add($o) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| . .\Employee.ps1 | |
| $CEO = [Employee]::new("John","CEO", 30000) | |
| $HeadSales = [Employee]::new("Robert","Head Sales", 20000) | |
| $HeadMarketing = [Employee]::new("Michel","Head Marketing", 20000) | |
| $clerk1 = [Employee]::new("Laura","Marketing", 10000) | |
| $clerk2 = [Employee]::new("Bob","Marketing", 10000) | |
| $salesExecutive1 = [Employee]::new("Richard","Sales", 10000) | |
| $salesExecutive2 = [Employee]::new("Rob","Sales", 10000) |
NewerOlder