Script & Terminal > Powershell

How good are Chat GPT generated Powershell scripts?

Chat GPT is an open-source language-generating AI model developed by OpenAI. It's latest releases generated massive waves of innovation, concern and awareness across multiple industries about AI. Some fear that it will replace people, while, others grasp its capabilities to enhance their own skills. I have written several scripts that ...

Export all Active Directory computers group membership

If you ever find your self in a situation where you cannot run scripts, yet need to obtain granular group membership for all your currently enabled Active directory computers, this one liner will slowly but steadily generate that report. After it finishes running you can use Excel to filter the ...

How to map drives and folders with Powershell?

Shared folders and NAS are a common in organizations of all sizes, even at home these days. They are useful to IT support professionals, for example, to backup valuable information or to store applications and other files. The first step is to confirm if the SMB V1/2 protocols are enabled ...

Uploading files to a FTP with Powershell

Let's imagine a scenario where a report generated through a Powershell script, needs to be made available to a crowd of users or IT staff. One method would involve converting the output to HTML, upload the resulting file to a web server. The report would be accessible using any web ...

How to output Powershell reports in HTML?

Powershell is a versatile scripting language, but viewing results in the shell can bring eye pain to some people, specially to who is accustomed to it. Using the example in the post about Powershell loops and a few additional lines in the script with the ConvertTo-Html and Out-File cmdlets, it's ...

Elementary Powershell loop with conditions

Loops are a fundamental part of automating repetitive tasks, allowing system administrators to perform repetitive tasks in multiple systems or items sequentially and autonomously. The need to handle or skip possible errors or issues arises , but Powershell has it covered in a couple of easy ways. The example in ...

Powershell scripting aids

Powershell, created and developed by Microsoft, is a useful scripting language compatible with all major operating systems, with its several hundred modules, each one with several unique cmdlets, memorizing all of them, is a next to impossible task, so knowing how to find help and syntax guides is a key ...

Block and forward a user’s email in Exchange server

Once in a while a user leaves the company and the necessity to block their access to the companies email and forward any new messages to their replacement or manager arises, the proverbial "business must go on". The script bellow can do just that in a quick and consistent way ...

Network troubleshooting with Powershell

Knowing how to troubleshoot network issues is a fundamental skill to all IT professionals. Usually in computers with Windows operating systems this task was delegated to CMD (Command Line), with commands like PING, TELNET or IPCONFIG. Note: 90% of the network commands from CMD are compatible with Powershell. Get-NetAdapter Shows ...

How to audit user’s AD group membership?

Auditing is a normal part of IT specially in banking or card industries. With tools like Active Directory used to manage accesses to several applications, folders and computers in business domains it can branch quickly. This script will generate a report in CSV, that will confirm or deny the presence ...

How to search for AD objects?

In large organizations usually most accesses, mailing groups and applications are managed through Active Directory groups. User details are also stored in AD and searching for them can be complicated via AD's GUI, yet doing it through Powershell opens a sea of possibilities. Get-ADObject -Filter 'Name -like "*Value*" -and ObjectClass ...

Basic PowerShell cmdlets for Active Directory

Note: These commands were made for Powershell V4, to check your version , type $PSVersionTable.PSVersion in your console. Run Powershell as administrator. The first cmdlet is used to verify if the the Active Directory module for Powershell is installed. The command bellow can be used Get-Module -name '*active*' -ListAvailable If ...