Skip to main content

Posts

Showing posts with the label Script

Python Script to list all open Pull requests from AWS CodeCommit repositories

The following Python script will help to export list of any open pull requests from CodeCommit repositories from an AWS account. The output will be saved within CSV file. #!/usr/bin/env python3.8 # This script is used to find out any open pull requests from all the repositories # from an account and write output to the csv file # Importing boto3, csv and time module import boto3 import csv import time # Setting up AWS profile and region profile = "default" region = "us-east-1" session = boto3 . Session ( profile_name = profile , region_name = region ) repo_client = session . client ( 'codecommit' ) repos = repo_client .list_repositories(     sortBy = 'repositoryName' ) repo_list = repos repo_name = repo_list [ 'repositories' ] # Getting current date and time date_time = time . strftime ( " %d %m%Y_%H%M%S" ) # Setting up file name fname = "Open_PullReqsIDs_" ftime = date_time fext = ".csv" filename

PowerShell command to export a list of domain users from AD group to a CSV file

Here I go with another post on PowerShell. This time, I would like to share a PowerShell command that will help you to export list of users of particular AD (Active Directory) group to a CSV file. Run PowerShell and type following commands: # This will import ActiveDirectory module Import-Module ActiveDirectory # This command will export list of users from GroupName to a CSV file Get-ADGroupMember -Identity "GroupName" -server "TestDomain" -recursive | get-aduser -Properties mail | select name , samaccountname | export-csv -path c:\Script\report.csv -NoTypeInformation In above command, replace GroupName with the Group you want to retrieve members list. Type your domain name in place of TestDomain . Once you run above command, it will create a CSV file “ Report.CSV ” and save it in C:\Script folder. I hope you find this post very useful. Disclaimer: www.TechieTalks.co.uk does not conceal the possibility of error and shortc

PowerShell Script: Find out free disk space from multiple servers

Hi All, this is my very first post on PowerShell Script. Today, I am going to share a script that you can use to find out free disk space from multiple servers. You will have to create a Text file and a PowerShell script to accomplish this. Let’s begin by creating a Text file. I have setup a folder on my C: Drive called PS_Script (C:\ PS_Script). I created a Text file, ServerNames.txt, and saved it in C:\PS_Script folder. Use following code to create a PowerShell script and save it as DiskReport.PS1. #Get Current date $currdate = ( Get-Date ) . tostring( "dd-MM-yyyy" ) #Set path for output file $report = "C:\PS_Script\" + "DiskSpaceReport_" + " $Currdate .html" #Run command to get free disk space from multiple servers and export output to HTML file Get-WmiObject Win32_LogicalDisk -filter "DriveType=3" -computer ( Get-Content C:\PS_Script\ServerNames.txt ) | Select SystemName , DeviceID , V