Introducing scripting and toolmaking
Showing posts with label PowerShell. Show all posts
Showing posts with label PowerShell. Show all posts
Wednesday, July 27, 2022
The pipeline: getting connected and extending the shell
The pipeline: getting connected and extending the shell
Thursday, October 1, 2020
Find out which application is running on a specific port, using PowerShell?
Find out which application is running on a specific port, using PowerShell?
let's take an example of port 4020.
run the below PowerShell cmdlet.
Get-NetTCPConnection | ?{$_.localport -eq 4020} | fl
Copy the PID.
Run the below cmdlet.
Get-Process -PID 2292 | fl
The process name found on this is msvsmon.
Wednesday, October 23, 2019
Get Group Members of multiple exchange distribution groups using PowerShell
Get Group Members of multiple exchange distribution groups using PowerShell
Create a text file 'C:\temp\AllGroups.txt' and put all group names.
$allgroup = Get-Content C:\temp\AllGroups.txt
foreach($i in $allgroup) {Get-DistributionGroupMember -Identity $i -ResultSize unlimited | Select-Object @{n='Groupname';e={$i}}, DisplayName,Alias,DistinguishedName,SAMAccountName,Id,PrimarySmtpAddress,RecipientType,ExternalEmailAddress | Export-Csv c:\temp\GroupWithMembers.csv -Append -NoTypeInformation }
Create a text file 'C:\temp\AllGroups.txt' and put all group names.
$allgroup = Get-Content C:\temp\AllGroups.txt
foreach($i in $allgroup) {Get-DistributionGroupMember -Identity $i -ResultSize unlimited | Select-Object @{n='Groupname';e={$i}}, DisplayName,Alias,DistinguishedName,SAMAccountName,Id,PrimarySmtpAddress,RecipientType,ExternalEmailAddress | Export-Csv c:\temp\GroupWithMembers.csv -Append -NoTypeInformation }
Friday, September 7, 2018
Create a multiple files in a folder using powershell
I want to create multiple files inside a folder. Suppose I want to name them from Benu1.csv , Benu2.CSV.. till Benu20.csv.
Also I want to put some content inside the files. Here I am writing Emailaddress as a value in the csv file.
You can create any type of file, use the file extension accordingly. Also you can increase/decrease the number of files you want.
1..20| foreach{New-Item -path c:\temp -ItemType File -Name "Benu$_.csv" -Value "EmailAddress"}
Also I want to put some content inside the files. Here I am writing Emailaddress as a value in the csv file.
You can create any type of file, use the file extension accordingly. Also you can increase/decrease the number of files you want.
1..20| foreach{New-Item -path c:\temp -ItemType File -Name "Benu$_.csv" -Value "EmailAddress"}
Subscribe to:
Posts (Atom)