Category: PowerShell

  • Add PowerShell Snippets to Visual Studio Code

    Add PowerShell Snippets to Visual Studio Code

    Add PowerShell Snippets to Visual Studio Code Intro Linux Windows Edit powershell.json Related Links Intro Visual Studio Code Snippets are stored in JSON files, one JSON file for each language PowerShell, Python, rust etc. In this write up we will be adding a new custom snippet ForEachWithProgress. Prefix = what you need to type in…

  • PowerShell Essentials

    PowerShell Essentials

    PowerShell Essentials Related Links Related Rounding Numbers in PowerShell AWS Tools for PowerShell Powershell Split Text into Individual Lines PowerShell Accepting Pipeline Input Install PowerShell Core on Raspberry Pi OS Moving AD Computer Object with Powershell Install RSAT on Windows Enable Telnet Client on Windows 10 Hashing in Windows Changing Windows Network Profile How to…

  • Powershell Split Text into Individual Lines

    Powershell Split Text into Individual Lines

    Powershell Split Text into Individual Lines Inline External File Related Links Inline External File Related PowerShell Accepting Pipeline Input Install PowerShell Core on Raspberry Pi OS Moving AD Computer Object with Powershell Rounding Numbers in PowerShell Extend Volume in Windows Install RSAT on Windows Enable Telnet Client on Windows Hashing in Windows Links https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-7.1

  • Extend Volume in Windows

    Extend Volume in Windows

    Extend Volume in Windows. Two methods will be covered here. PowerShell and DiskPart PowerShell DiskPart Related Links PowerShell In this example a C:\ partition will be extended by 1 GB on a 100 GB disk . System Reserved 549 MB C: 99.46 GB The Resize-Partition cmdlet will be used. It requires Size argument that is…

  • PowerShell Accepting Pipeline Input

    PowerShell Accepting Pipeline Input

    PowerShell Accepting Pipeline Input. There are two ways to accept pipeline input ValueFromPipeline = $true ValueFromPipelineByPropertyName = $true Related Links Prerequisite [cmdletbinding()]Param([Parameter(ValueFromPipeline)]] OR [Parameter(ValueFromPipelineByPropertyName)]]) ValueFromPipeline This method accepts the whole object as input and gives you access to all of the objects properties. ValueFromPipelineByPropertyName This method accepts only the value of a single property.Equivalent of…

  • Hashing in Windows

    Hashing in Windows

    Hashing in Windows Powershell File Text Command File Powershell File Text Command File Related Links Related Working With SSH Keys Create a Password Hash in Linux Create OpenSSL CA (Certificate Authority) for Dev/Test Purposes WireGuard Essentials Changing Windows Network Profile How to check for Suspicious root CA certificates in Windows How to Start an Application…

  • Install PowerShell Core on Raspberry Pi OS

    Install PowerShell Core on Raspberry Pi OS

    Install PowerShell Core on Raspberry Pi OS Related Links To find the latest version of PowerShell Core go to https://github.com/PowerShell/PowerShellPlatform = Raspbian (Arm) 32-bit -x = Extract -f = File -v = Verbose Optional Related AWS Tools for PowerShell Configure Windows to be Managed via Ansible Check for Pending Reboot on Windows Extend Volume in…

  • Changing Windows Network Profile

    Changing Windows Network Profile

    Changing Windows Network Profile Related Links Name : Wireless InterfaceAlias : Wi-Fi InterfaceIndex : 2 NetworkCategory : Public IPv4Connectivity : Internet IPv6Connectivity : NoTraffic Name : Ethernet InterfaceAlias : LAN InterfaceIndex : 1 NetworkCategory : Public IPv4Connectivity : NoTraffic IPv6Connectivity : NoTraffic Name : Wireless InterfaceAlias : Wi-Fi InterfaceIndex : 2 NetworkCategory : Private IPv4Connectivity…

  • Moving AD Computer Object with Powershell

    Moving AD Computer Object with Powershell

    Moving AD Computer Object with Powershell A computer object in powershell is represented by TypeName: Microsoft.ActiveDirectory.Management.ADComputer.ADComputer has a property “DistinguishedName”. At time of writing this Microsoft.ActiveDirectory.Management.ADComputer has no methods to change this value. Use Move-ADObject to change its location in AD. An AD Orginizational Unit is represented byTypeName: Microsoft.ActiveDirectory.Management.ADOrganizationalUnit.It has a property of “DistinguishedName” Using…

  • Regular Expression RegEx RegExp Resources

    Regular Expression RegEx RegExp Resources

    Regular Expression RegEx RegExp Resources Quantifiers Special Symbols Braces Look Ahead Look Behind DotNet RegEx Class Related Links Quantifiers *Zero of more of the character that immediately precedes it +One or more of the character that immediately precedes it ?Zero or One of the character that immediately precedes it Special Symbols ^Start of line $End…

  • Rounding Numbers in PowerShell

    Rounding Numbers in PowerShell

    Rounding Numbers in PowerShell $Number = 13.5 Cropping: [math]::Truncate($Number) 13 Rounding Down: [math]::Floor($Number) 13 Rounding Up: [math]::ceiling($Number) 14 Standard 0-4 Round Down 5-9 Round Up: [math]::Round($Number) 14

  • How to setup WinRM in a WorkGroup Non Domain Environment

    Disclaimer: This will create a very basic unsecured/not encrypted connection. This should only be done in a test lab environment. This is being setup in a Non Domain/Work group setting. There is no certificate or DNS infrastructure in place. The connections will be going over TCP 5985. This is the Default TCP Port for not…

  • How to turn the Windows Firewall On or Off Via the Command Line.

    How to turn the Windows Firewall On or Off Via the Command Line.

    Via Command.exe Turn Off netsh advfirewall set allprofiles state off Turn On netsh advfirewall set allprofiles state on Via Powershell Turn Off Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False Turn On Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True