r/PowerShell • • May 12 '22

Thank you all.

127 Upvotes

I just want to say that I started learning powershell and scripting with it just over a year ago. This reddit group has helped me a lot along the way. I can safely say that each time I come to view the posts and the comments, I ALWAYS learn something new that makes my brain go "WHA you can do that?" or "HUH why haven't I been doing it that way?!"

You guys n gals truly are some awesome folks. Though I haven't posted here often, you all show support to anyone who does post here and usually give more than one route to use as we all know every network is different and some methods work, some don't.

I'm still in the learning stages but I've been able to create multiple scripts for my team because of you guys and your info, knowledge, and support. Alright soppy time over.


r/PowerShell • • Jun 16 '21

'ipconfig /all' - Posh version

127 Upvotes

Another of my - 'Not sure how useful this is but...'

I wanted a more comprehensive, and easier to read, output of a systems network settings, etc...

An image of what the output looks like is shown here: http://www.somethingtoscrollthrough.com/2021/06/ipconfig-all-posh-version.html

This is set-up as a Function, and it has an alias.

I call these functions from both PoSh profiles (ISE and Console).

Here is the code:

https://github.com/richie65x/Modules/blob/main/Get-IP.psm1

Function Get-IP {

Write-Host "Fetching IP info..." -ForegroundColor Gray -BackgroundColor Black
$AdapterList = @()
Get-NetAdapter | ? {$_.InterfaceDescription -NOTmatch 'Bluetooth'}  | % { 
$adapter = $_
$prefix = (Get-NetIPAddress -InterfaceIndex $adapter.InterfaceIndex | ? {$_.ipv4address}).prefixlength
('1' * $prefix).PadRight(32, '0') | Out-Null;$bitString=('1' * $prefix).PadRight(32,'0'); $SnM=[String]::Empty
    for($i=0;$i -lt 32;$i+=8)
    {$byteString=$bitString.Substring($i,8); $SnM+="$([Convert]::ToInt32($byteString, 2))."}
If ((Get-NetIPInterface -InterfaceAlias $_.InterfaceAlias).Dhcp -eq "Enabled") {$DHCP = "DHCP"} else {$DHCP = "STATIC"}
$AdapterList += ((Get-NetIPConfiguration | ? {$_.InterfaceIndex -match "$($adapter.InterfaceIndex)"} | select `
    @{Name='Alias';Expression ={$_.InterfaceAlias}},`
    @{Name='Status';Expression ={$_.NetAdapter.Status}},`
    @{Name='IPAddress';Expression ={"$($_.IPv4Address.IPAddress) ($DHCP)"}},`
    @{Name='SubnetMask';Expression ={"$($SnM.TrimEnd('.')) (/$prefix)"}},`
    @{Name='Gateway';Expression ={$_.IPv4DefaultGateway.NextHop}},`
    @{Name='DNSServer(s)';Expression ={$_.DNSServer.ServerAddresses}},`
    @{Name='MAC';Expression ={$adapter.MacAddress}},`
    @{Name='Index';Expression ={$_.InterfaceIndex}},`
    @{Name='Description';Expression ={$_.InterfaceDescription}}))
    }
Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -ForegroundColor Gray
$AdapterList | % {
$_ | % {
If ($_.IPAddress -match "169.") {
    $_.IPAddress = "($DHCP)"
    $_.SubnetMask = " - "
}

$Item00 = $_
($Item00 | Out-String).Split("`n|`r",[System.StringSplitOptions]::RemoveEmptyEntries) | % {
If ($Item00.Status -match "Disconnected") {Write-Host "█ " -fore Red -No }
If ($Item00.Status -match "Up") {Write-Host "¤ " -fore Green -No }
If ($_ -match "Index") {Write-Host " " $_ -ForegroundColor cyan} 
If ($_ -match "Alias") {Write-Host " " $_ -ForegroundColor Yellow} 
If ($_ -match ": Up") {Write-Host " " $_ -ForegroundColor Green} 
If ($_ -match ": Disconnected") {Write-Host " " $_ -ForegroundColor Magenta}
If ($_ -NOTmatch "Index" -and $_ -NOTmatch "Alias" -and $_ -NOTmatch "Status") {Write-Host " " $_} 
}

($Item00 | Out-String).Split("`n|`r",[System.StringSplitOptions]::RemoveEmptyEntries) | % {
    If ($_ -match "Alias" -and $_ -match "Wi-Fi" -and $Item00.Status -match "Up") {
        netsh wlan show interfaces | % {
            If ($_ -match "SSID" -and $_ -NOTmatch "BSSID") {$SSID = $_}
            If ($_ -match "State") {$State = $_}
            If ($_ -match "Signal") {$Signal = $_}
            If ($_ -match "Authentication") {$Auth = $_}
        }
            Function SplitWrite($arg0) {Write-Host ($arg0.Split(':')[1]).Trim() -Fore 11}
                Write-Host "             SSID: " -Fore 14 -No; SplitWrite $SSID
                Write-Host "            State: " -Fore 14 -No; SplitWrite $State
                Write-Host "           Signal: " -Fore 14 -No; SplitWrite $Signal
                Write-Host "             Auth: " -Fore 14 -No; SplitWrite $Auth
    } 
}

}
Write-Host "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -ForegroundColor Gray
}

} # End Function Get-IP

set-alias -name gip -value Get-IP

r/PowerShell • • May 11 '21

What have you done with PowerShell this month? Oh, not much... I just used it as part of my ransomware to take out a major pipeline where there is a state of emergency and gas stations are running dry on the east coast

127 Upvotes

https://www.zdnet.com/article/colonial-pipeline-ransomware-attack-everything-you-need-to-know/

Interesting read... the attackers wrote a PS script which deleted volume shadow copies. It didn't say if the encryption was a part of that script.


r/PowerShell • • Aug 04 '19

Script Sharing Working with HTML in PowerShell just got better

127 Upvotes

Here's a short article on how you can use new features of PSWriteHTML, Emailimo or Dashimo

https://evotec.xyz/working-with-html-in-powershell-just-got-better/

I've added a lot of nice features for tables and reworked lots of code. It's possible to achieve much more now when creating reports, dashboards or sending emails. Statusimo changed its look a bit, but not so much. Enjoy and if something doesn't work let me know :-) New feature requests are also welcome.

If you work with HTML - creating reports, creating emails - this one is for you. Below screenshots were created with almost 0 effort.


r/PowerShell • • Jun 03 '18

Join Linux to Active Directory with PowerShell Core

Thumbnail
winsysblog.com
127 Upvotes

r/PowerShell • • Mar 22 '18

Misc Wait! There are JOINs in PowerShell

Thumbnail
nocolumnname.blog
127 Upvotes

r/PowerShell • • Mar 07 '24

Misc Python vs PowerShell?

126 Upvotes

I'm a .Net stack developer and know PS very well but I've barely used Python and it seems like Python has been constantly moving towards being the mainstream language for a myriad of things.

I see Microsoft adding it to Excel, more Azure functionality, it's #1 for AI/machine learning, data analysis, more dominate in web apps, and seemingly other cross platform uses.

I've been hesitant to jump into the Python world, but am I wrong for thinking more of my time should be invested learning Python over PowerShell for non-Windows specific uses?

Or how do people familiar with both PS & Python feel about learning the languages and their place in the ecosystem?


r/PowerShell • • May 28 '23

Script Sharing Password Quality Scan in Active Directory

126 Upvotes

Hello,

I wrote this nice PowerShell module, PasswordSolution, in the last couple of months. It has two functionalities:

- send password notifications to users (not today's topic, separate blog post coming)

- analyze active directory passwords (today's topic)

The feature to analyze active directory passwords utilizes the DSInternals PowerShell module and provides HTML-based reports around its output, making it nice and pretty, ready for management.

By running the command (yes, it's a single line, after installing 2 PS Modules):

Show-PasswordQuality -FilePath C:\Temp\PasswordQuality.html -WeakPasswords "Test1", "Test2", "Test3" -Verbose -SeparateDuplicateGroups -AddWorldMap -PassThru

It will create an HTML report and analyze password hashes of all users in Active Directory, find duplicate passwords between user groups, and finds who's using weak passwords provided along with several other problems around passwords hygiene:

- AESKeysMissing

- DESEncryptionOnly

- DelegatableAdmins

- DuplicatePasswordGroups

- DuplicatePasswordUsers

- ClearTextPassword

- LMHash

- EmptyPassword

- WeakPassword

- PasswordNotRequired

- PasswordNeverExpires

- PreAuthNotRequired

- Kerberoastable

- SmartCardUsersWithPassword

While it uses DSInternals for the data, it then prettifies the output by using PSWriteHTML and ActiveDirectory module to make sure it gives you a complete picture

The blog post about it:

- https://evotec.xyz/strengthening-password-security-in-active-directory-a-powershell-powered-approach/

Sources:

- https://github.com/EvotecIT/PasswordSolution

Since I can't attach any pictures, you will need to go for a blog post to see how useful it is. Please make sure to read warnings, as this tool should only be run after approval from Security.


r/PowerShell • • Apr 04 '22

Information Cheat Sheet for Azure PowerShell

Thumbnail
github.com
126 Upvotes

r/PowerShell • • Apr 26 '21

Information 5 PowerShell Gallery modules for Windows Server Administration

Thumbnail
techcommunity.microsoft.com
126 Upvotes

r/PowerShell • • Apr 08 '21

Script Sharing PowerShell module to Visualize and Document Azure Infrastructure

126 Upvotes

Hi Everyone,

I recently resumed working on a year-old PowerShell module that I left incomplete, but now I've made enough progress to share it with everyone. Please take a look and let me know what are your thoughts and provide constructive feedback here or on the Github repository as an issue on the project. Thank you! 😇

Azure Visualizer, aka "AzViz"

A #PowerShell module to automatically generate Azure resource topology diagrams or rich infrastructure visualizations by just typing a PowerShell cmdlet and passing the name of one or more Azure Resource Groups.

# install from powershell gallery
Install-Module AzViz -Verbose -Scope CurrentUser -Force

# import the module
Import-Module AzViz -Verbose  

# login to azure, this is required for module to work

Connect-AzAccount

What this module can do?

  • Can target 1 or more Azure Resource groups at once.

  • All Resource Groups are labeled with names and the entire graph is labeled with Subscription Name/Id

  • Visualization generated can be in any of two formats: PNG, SVG

  • Support Icons for 50+ most popular Azure Resource types.

  • Labels each Azure resource (also known as nodes) with information like Name, Provider, Type, etc. And Ability to increase or decrease the label verbosity

  • Connect dependent nodes with edges, if dependency between them exists. Basically using the 'DependsOn' property in an ARM template.

  • Supports themes in visualization images like light, dark, and neon

  • Ability to change direction in which resource groups are plotted, i.e, left-to-right or top-to-bottom.

  • Resource filtering based on categories/sub-categories and types like Microsoft.Storage/storageAccounts and Microsoft.Storage/storageAccounts/blobServices

  • Ability to Rank Azure resource (Work in progress). This feature will enable you to control the position of resources, for example, I like to see my load balancers at the top of my image.

Side Note: Cloud admins are not anymore doomed to manually document a cloud environment! The pain of inheriting an undocumented cloud landscape to support is gone 😎😉. So please share this post/project with your colleagues and friends, so that I can get diverse feedback and which will also help me reach out to individuals who want to collaborate on this open-source project.

Future of this Module

  • Right now I’m fiddling with two ideas to generate the visualization

  1. using dependsOn property in ARM template to find dependency in an ARM template

  2. and using Network watcher to find associations. Which also provides the network flow like PublicIP > LoadBalancer > NIC > VM . I may end up using both because both have pros and cons, and overlaying data from both these approaches on the same graph will give amazing details and insights into your Azure infrastructure.

  • Today we only use ‘GraphViz‘ which is open-source visualization software, I will add support for more visualization engines, graphing tools like Visio, Lucid Charts, etc

  • Ability to expose 'Custom properties' of an Azure resource type on the image, like IPAddress on NIC card, etc

  • Right now, the module doesn’t support clustering similar resources and subcategories into a logical cluster/group. This is a work in progress and would make the diagram much easier to understand once implemented.

  • Ability to exclude Azure resource types like Microsoft.Storage/storageAccounts/blobServices .

  • Support visualization from ARM templates passed as an URL or a local File - Work in progress!.

  • Infrastructure DIFF! yeah, you heard it right this is going to be my favorite feature to implement. This will give us the ability to identify/detect what has changed in Azure infrastructure, for example, a resource has been deleted, or IPAddress has been changed something like that.

Thanks!
Prateek


r/PowerShell • • Jul 04 '20

Script Sharing [NSFW] A script that pulls m3u8 playlist links and opens them stream in VLC player. NSFW

126 Upvotes

Hopefully sharing the script is acceptable. As labeled, this is NSFW. The script pulls the M3U8 streams from an adult site and then passes that info into VLC allowing you to open live camera streams in VLC without ever opening a browser!

To run the script, copy and paste the code into your favorite text editor or Powershell ISE and run it. The script initially checks to see if VLC is installed and if not, it will install the latest version for you. Then you are asked if you want to select page numbers or not as there are many pages of live cam feeds. Selecting 'No' or giving an invalid input results in the default of page 1 loading. If you chose 'Yes' for page choosing a page number, then you will be prompted which page of camera feeds you want to pull (I limited it to a single page because if you pull all pages, you'll get an HTTP 429 error). Then you'll see a menu with 9 choices. Make your selection, get prompted to choose a camera feed via an out-gridview window, and then VLC will open with the selected camera stream.

Why write this script? Boredom and wanting to improve on learning PowerShell scripting. While I'm sure it could be done better, I think it's pretty cool that it works. Again, this is not work-appropriate, and you should only play around with this if you are over 18!

<# This script is NSFW!!! 
##Is pulls the M3U8 link from a certain adult site and then
## opens that in the x64 version of Videolan's VLC Player. Feel
## free to tweak it if you want. It was a stupid project thats 
## purpose was to explore scripting.
##
## If you are under 18, do not run this script! You've been warned!
..
..
..
## PRE-REQUISITES -
##   Powershell v5 or higher
##   VideoLAN VLC Player x64 version
##   Tested only on a Windows 10 OS
##   
#>

#Check if VLC Media Player is installed
#If not, install the software
$software = "VLC media player";
$installed = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where { $_.DisplayName -eq $software }) -ne $null

If(-Not $installed) {
    Write-Host "'$software' is not installed. Proceeding to install" -ForegroundColor Red
	$vlcURL = "https://download.videolan.org/vlc/3.0.8/win64/"
    $getHTML = Invoke-Webrequest -Uri $vlcURL
    $name = ($getHTML.ParsedHtml.getElementsByTagName("a")| Where {$_.innerhtml -like 'vlc-*.exe'}).innertext
    $vlcURL = "https://download.videolan.org/vlc/last/win64/$name"
    
    $outPath = "$env:HOMEDRIVE\$env:HOMEPATH\temp"
    $outFile = "$env:HOMEDRIVE\$env:HOMEPATH\temp\installer.exe"
    
    mkdir $outPath -Force
    
    (New-Object System.Net.WebClient).DownloadFile($vlcURL, $outFile)
    
    Start-Sleep -Seconds 20
    
    & $outFile /L=1033 /S
    } else {
	Write-Host "'$software' is installed." -ForegroundColor Green
    }

#Prompt for choosing pages to load
clear
Write-Host "Do you want to select pages?" 
Write-Host "NOTE: Invalid entries register as a 'No'"
Write-Host "(1)Yes`n(2)No" 
$ChoosePage = Read-Host

#Variable set (originally pop-up prompts were used but it was annoying so they are gone now. 
#Values were left the same since everything works as is
$Loop = 6
$history = @()
While ($Loop -eq 6) {
    #Choose stream 
    $model = New-Object -TypeName psobject   
    clear
    
    #Menu Output
    $Choice= Read-Host "Select a number:`n=-=-=-=-=-=-=-=-`n(1)Featured`n(2)Female`n(3)Male`n(4)Couple`n(5)Trans`n(6)Open previous stream`n(7)Close All VLC`n(8)Show History`n(9)Quit`nSelection"
    
    #Set link for 
    switch ($Choice){
        "1" {
            write-host "You chose Featured!"
            $pageURL = "https://chaturbate.com/"            
            $model | Add-Member -MemberType NoteProperty -Name List -Value "Featured"            
        } 
        "2" {
            write-host "You chose Female"
            $pageURL = "https://chaturbate.com/female-cams/"
            $model | Add-Member -MemberType NoteProperty -Name List -Value "Female"
        } 
        "3" {
            write-host "You chose Male"
            $pageURL = "https://chaturbate.com/male-cams/"
            $model | Add-Member -MemberType NoteProperty -Name List -Value "Male"
        } 
        "4" {
            write-host "You chose Couple"
            $pageURL = "https://chaturbate.com/couple-cams/"
            $model | Add-Member -MemberType NoteProperty -Name List -Value "Couple"
        } 
        "5" {
            write-host "You chose Trans"
            $pageURL = "https://chaturbate.com/trans-cams/"
            $model | Add-Member -MemberType NoteProperty -Name List -Value "Trans"
        }
        "6" {
            write-host "Reopen previously opened stream"            
        }

        "7" {
            #Check if VLC is running and kill the process
            $VLC= Get-Process vlc -ErrorAction SilentlyContinue
            if ($VLC) {
              # try gracefully first
              $VLC.CloseMainWindow()
              # kill after five seconds
              clear
              Sleep 2
              if (!$VLC.HasExited) {
                $VLC | Stop-Process -Force
              }
            }
            Remove-Variable VLC 
        }
        "8" {
                if ($history -ne ""){ 
                    clear
                    $history |FT
                    pause
                    }
                else {                    
                    clear
                    write-host "No history"
                    pause
                    }
        }
        "9" {
            write-host "Quitting"
            $Loop++
        }
    }
     
    If($Choice -lt 6){
        
        If($ChoosePage -eq 1){
        #Grab the total number of pages
        $scrape= Invoke-WebRequest $pageURL -UseBasicParsing
        $PageCount = $PageCount = ($scrape.Links | Where-Object {$_.href -like "*?page=*"}).href
        $PageCount = $PageCount[3].split("=")
        $PageCount = $PageCount[1]
        
        #Ask User which page to select
        Write-Host "Which page of models do you want to view? Pages 1 through $PageCount are available."
        $i = Read-Host
        if($i -le $PageCount) {
            Write-Host "Loading page $i..." -ForegroundColor Green
            } else { 
            Write-Host "Invalid entry: Loading page 1" -ForegroundColor Red
            $i = 1
            }
        } else { $i = 1}
        $m3u8= Invoke-WebRequest "$pageURL`?page=$i" -UseBasicParsing
        $m3u8 = ($m3u8.Links | Where-Object {$_.href -notlike “/tag*”} | Where data-room).'data-room'
        $m3u8 = $m3u8 | ForEach-Object {$_.tostring()}
        $m3u8= $m3u8 | ForEach-Object {$_.tostring()} | Select-Object -Unique
        
        $Choice = $m3u8 | Out-GridView -PassThru



        $model | Add-Member -MemberType NoteProperty -Name Name -Value "$Choice"        

        #Pull streaming link
        $URL = "https://chaturbate.com/$Choice/"
        $WebResponse = Invoke-WebRequest -Uri $URL -Headers @{"accept"="application/json"}        
        $WebResponse = $WebResponse.ToString()
        $pos1 = $WebResponse.IndexOf("m3u8") + 4
        $pos2 = $WebResponse.IndexOf("m3u8") - 300
        $link = ($WebResponse.Substring($pos2,304))
        $pos3 = ($link.IndexOf("https://"))
        $pos1 = $link.IndexOf("m3u8") + 4
        $linklength = $pos1 - $pos3
        $link = $link.Substring($pos3,$linklength)
        $link = $link.Replace("\u002D","-")
        $model | Add-Member -MemberType NoteProperty -Name Link -Value "$link" 
        clear
            
        #Uncomment the next line if you want the below popup prompt
        #$OpenVLC = $wshell.Popup("Do you want to continue?",0,"Alert",64+4)
        $OpenVLC = 6    
        
        #Open stream in VLC media player
        if ($OpenVLC -eq 6){
            cd ${Env:ProgramFiles}
            $program = "VideoLAN\VLC\vlc.exe"
            $programArgs = "--zoom=0.25 --mmdevice-volume=0"
            Invoke-Command -ScriptBlock { & $program $link $programArgs}
            }
        #Uncomment the next line if you want the below popup prompt
        #$Loop = $wshell.Popup("Refresh the list?",0,"Alert",64+4)
        
        #creating array for historical output (option 6 in the menu)
        $history += $model
        clear
    } elseif($choice -eq 6){
        #Reopen a previously opened stream
         $Choice = $history | Out-GridView -PassThru
         $link = $Choice.Link
         $OpenVLC = 6    
         #Open stream in VLC media player
         if ($OpenVLC -eq 6){
            cd ${Env:ProgramFiles}
            $program = "VideoLAN\VLC\vlc.exe"
            $programArgs = "--zoom=0.25 --mmdevice-volume=0"
            Invoke-Command -ScriptBlock { & $program $link $programArgs}
            }
        }                
        Remove-Variable model
    }
clear

r/PowerShell • • Jun 01 '20

They're back!!! For everyone now, vs just us folks who paid for it -- ;-} Introducing SAPIEN Free Tools

126 Upvotes

In 2018, SAPIEN Technologies discontinued the SAPIEN Productivity Pack from receiving further updates or additional support. It was removed from our website and no longer offered. After careful consideration and at the request of many of our customers, we have made the decision to reintroduce these tools to our community.

What was once known as the SAPIEN Productivity Pack, will now be known as “SAPIEN Free Tools”. That’s right, our tools you have all come to know and love are now available on our website as a free download.

This collection of software utilities is an assemblage of useful tools for system administrators, developers, and DevOps. Whether you are working with PowerShell, VBScript, Jscript, C++, C#, SQL or HTML, our tools will work for you. Please note that these downloads are only available for use on a 64-bit platform.

https://www.sapien.com/blog/2020/04/14/introducing-sapien-free-tools/


r/PowerShell • • Apr 09 '20

PowerShellGallery disables support for TLS 1.0 breaking Install-Module

126 Upvotes

In case you use Install-Module/Update-Module for PowerShell modules on PowerShellGallery you may want to update your scripts with TLS 1.2 setting to prevent issues.

Before running Install-Module/Update-Module you may be now required to run:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

If you're affected you will see errors similar to what I did:

WARNING: Source Location ‘https://www.powershellgallery.com/api/v2/package/PSEventViewer/1.0.13' is not valid.PackageManagement\Install-Package : Package ‘PSEventViewer' failed to download.At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21+ … $null = PackageManagement\Install-Package @PSBoundParameters+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : ResourceUnavailable: (C:\Users\adm_jz…entViewer.nupkg:String) [Install-Package], Exception+ FullyQualifiedErrorId : PackageFailedInstallOrDownload,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

This, of course, varies from system to system depending on system defaults. More on the blog: https://evotec.xyz/powershellgallery-disables-support-for-tls-1-0-breaking-install-module/

Edit: as suggested by Chris Bergmeister it's better to use -bor option.

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12

r/PowerShell • • Feb 23 '20

Misc Is powershell a programming language? Can it be a gateway to a programming career?

126 Upvotes

Hello. I was recently promoted to a very small sub-team of the IT department for a large utility company. My job now is to replace old company computers with new ones. This involves many processes that aim to bring the state of the new machine to match the old one (software and settings).

(Skip to "TO GET TO THE POINT" if you don't want background)

I was brought on just after a few guys left the team. Including one guy who made a Powershell script that automates one aspect of this backup/restore process. My co-worker expressed fear that if this Powershell script stopped working, we'd have to do that manually because nobody else on the team knows Powershell.

So I took it upon myself to learn it.

I don't know any programming language and I have never heard of Powershell before, but I dove right in and quickly made some simple scripts that can check the name and location data of a hardware asset. Over the next few months, I have made around 15 scripts that automate various steps in our process ranging from a dead simple, patch pinging script to a complex (for me) mulitstep backup and restore script.

TO GET TO THE POINT

I really enjoy making Powershell scripts. It makes me feel like some kind of wizard. I am thinking I may want to steer my career towards programming. Is Powershell a good representation of programming in general? Where do I go from here?


r/PowerShell • • Jun 05 '18

Made my first script today!

126 Upvotes

Although I have been using other peoples scripts, and editing as needed, I have always avoided taking the plunge with PowerShell.

But today.......today I made my own script and it worked! It was pretty simple and only counted the number of objects in three AD security groups and then moved them into different security groups (and took additional AD creds), but it worked!

Happy!

Edit: Thanks for the comments, guys! What is even cooler is that I have just had to use a variation of the same script again. All the work this morning even paying off this afternoon.

Edit 2: Thanks again for all the positive feedback! I am going to comment my script and keep it safe :).


r/PowerShell • • Apr 06 '18

Script Sharing PowerShell Scripting guide to Python : Part-2

Thumbnail
ridicurious.com
126 Upvotes

r/PowerShell • • Feb 01 '18

LPT: For those learning powershell, this one simple thing will have you picking up everything twice as fast.

126 Upvotes

I'm learning powershell too. I google a lot like the rest of us. But i used to find a handy one-liner online and copy pasta into my ISE window UNTIL I was forced to use a VDI that didnt have copy paste, so I was forced to type what I was reading from the other screen. These one-liners started to burn into memory WAY better for me, and before long I didnt have to google them anymore.

Try it. With one-liners force yourself to write it out into Powershell ISE with all the add-ons enabled for tab autcomplete. Before long you will be above average and be able to recall your top 10 one-liners instantly. Those top 10 I find are 80% of my powershell usage. So I kind of feel like a gun now :-p

SUCCESS!!


r/PowerShell • • Aug 18 '17

Script Sharing How To Create Progress Bars in PowerShell

Thumbnail
mcpmag.com
126 Upvotes

r/PowerShell • • May 10 '17

Announcing PowerShell for Visual Studio Code 1.0!

Thumbnail
blogs.msdn.microsoft.com
126 Upvotes

r/PowerShell • • Jun 11 '24

How can I create a password, safely store it in a script then decode it?

125 Upvotes

I'll use the Spaceballs reference...

Lets say my Admin password is 12345. I want to store 12345 in my script, because I want to create a script that will create an Admin.

Is there any way to encrypt the password of 12345, store that value in the script, then decrypt it when the script needs it to know what the password is to create the user?

I'm looking for methods already built into Powershell, I'm not looking to create my own encryption/decryption.


r/PowerShell • • Dec 14 '21

Uncategorised I just wanted to share my love for Powershell!

125 Upvotes

I recently started learning PowerShell and what a tool!
Deleting 87 empty folder in a directory tree with a single line of code;

Searching for that one folder that I have no idea where is located on the hard drive;

Getting the exact information from the eventlogs without needing to manually search it on event viewer;

Closing all running applications using a single line of code;

Finding that file that contains a specific word in it and finding its path;

Getting all the names of the books in a specific page from a website into a txt file without having to manually type them in or even see the book titles at all;

I know this is 0.0001% of the capabilities of PS but I am loving it so much! I have been using it daily just so I can get familiar with the cmdlets and modifiers. PowerShell is an amazing tool and I can't believe I have not been using it earlier. People at my company get mind-boggled when they see me accomplish tasks it takes them half a working day in just few minutes.
Say what you will of Microsoft but this tool is amazing! Thank you for the creators, maintainers and whoever contributed to it.


r/PowerShell • • Apr 27 '21

Office 365: Now you can mark your external emails easily with native PowerShell cmdlet

125 Upvotes

Microsoft has introduced a new 'External' tag to provide a native experience to identify external emails. This native method overcomes the disadvantages of the existing Transport rule configuration method.

https://o365reports.com/2021/04/27/enable-external-email-warning-tag-in-exchange-online/

Start enabling this most-awaited feature for your organization too.


r/PowerShell • • Apr 19 '20

Information Blog Post: How To Create An HTML Report With PowerShell

125 Upvotes

Hey guys, Dan Dimalanta just wrote a shiny new blog post you may enjoy.

Summary: Learn how to use the PowerShell ConvertTo-HTML cmdlet and CSS to create a beautiful HTML report with PowerShell!

Dan really went above and beyond with this one. I've been building simple HTML reports for years but I never really considered how good they can look if you add a little CSS in there too.

https://adamtheautomator.com/powershell-convertto-html/