Jump to content

Looking for some Powershell scripting ideas for class. What are some fun and simple projects to do? This is an intro to Powershell class and can't think of any ideas. 

 

I had the idea of doing a script to send me a message when a folder reaches a certain amount of space. What do you guys think? Is it possible and would it take long to write it?

 

Thanks!

Link to comment
https://linustechtips.com/topic/586941-powershell-project/
Share on other sites

Link to post
Share on other sites

Powershell is only really used for Windows, so you could do powershell over internet.
In our Scripting and Hacking course this was the last thing we had to do, use powershell through meterpreter to grab files tagged as "important".
You could also create some for loops, and use ping to create a ping sweep

Link to comment
https://linustechtips.com/topic/586941-powershell-project/#findComment-7661056
Share on other sites

Link to post
Share on other sites

Powershell has a "msg" function if you're on the same network so you could just use that for the notification, then you should be able to trigger it by just getting the folder size such as here just leave out the last part since you don't need the mb count and then let the script loop til either the notification is sent or a set time.

I'm not sure of the syntax in power shell but something like

Quote

do

set a = (volume from function)

 

 If a >= allotted volume

    msg computer-name 'file too large'

    end

 else

   goto do

 

 

                     .
                   _/ V\
                  / /  /
                <<    |
                ,/    ]
              ,/      ]
            ,/        |
           /    \  \ /
          /      | | |
    ______|   __/_/| |
   /_______\______}\__}  

Spoiler

[I5-12600k | 32gb DDR5 6000 | RTX5070 | 2x1tb M.2]

 

[Ryzen 5 1600 | 16gb DDR4 3200 | GTX1030 | 4x 8tb HDD] 

 

Link to comment
https://linustechtips.com/topic/586941-powershell-project/#findComment-7665107
Share on other sites

Link to post
Share on other sites

On 4/25/2016 at 1:05 PM, SNES4Life said:

Looking for some Powershell scripting ideas for class. What are some fun and simple projects to do? This is an intro to Powershell class and can't think of any ideas. 

 

I had the idea of doing a script to send me a message when a folder reaches a certain amount of space. What do you guys think? Is it possible and would it take long to write it?

 

Thanks!

There is a 30 second script for you.

Function Check-FileSize {
    
    [CmdletBinding()]
    Param(
        [string[]]$folders,
        [string]$sizelimit
    )
    BEGIN {
        #check for schedualed task to run on startup -> should fire this script
        #if it does not exist create it
    }
    PROCESS {
        while ($true) {
            foreach ($folder in $folders){
                $watcher = Get-ChildItem -Path $folder | select -Property Length
                if ($watcher.length -gt $sizelimit){
                    Send-MailMessage -From $email -To $otheremail -Body "$folder is larger than $sizelimit. Current size is $(watcher.length)"
                }
            }
			Start-Sleep 5
        }
    }
    END {
        #anything you want to close off at the end.
    }
}

I'd say for powershell script ideas you can look at:

1. AD user creation (including setting up exchange/office365 mailboxes, copying user groups from a template / assign to correct security groups etc)

2. Automated user exit ( i.e. on 'd-day' disable account, on 'd-day' + 30 delete the account (or not?))

3. Script for AD username changes (i.e. it will need to look for any computer on the domain that the user profile is present and apply some registry changes).

4. Pull Log files from csv/txt format and import them into SQL server (or access).

5. Check for reboots required in the domain (i.e. after patch tuesday, you might have client's that don't set deadlines on their computers, so they don't auto-reboot).

6. Script to get the SMART Status of all HDD's on the network.

7. Script to uninstall a program

8. Script to install a program.

9. control script to run 7 then 8.

10. re-arm any office installs on the network.

11. Add emailing/showing the results to an email to all the above.

12. auto-create cisco config files.

 

Link to comment
https://linustechtips.com/topic/586941-powershell-project/#findComment-7667149
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×