Powershell

17K

Solutions

8K

Contributors

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.

Share tech news, updates, or what's on your mind.

Sign up to Post

I need to pull some information from AD using powershell.

I need

fName, lName, fullName, emailAddress, IPphone number, OU

anyone have a script I can borrow that will pull that to a CSV File?

Thanks!
0
Cloud Class® Course: Certified Penetration Testing
LVL 12
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Dear expert

I would like to programming using powershell the idea is in a test like this:

Text, text, Text, text, Text, text,
Text, text, Text, text, Text, text, Text,
text, Text, text, Text, text, Text, text, Text,
 
text1, Text2, text3, Text4, text5, Text6, text, Text, text, Text, text, Text, text, Text,

I was to grab the last line of text like  text5 and replace the text5 to test_weti is it possible?
0
How to check if a specific patch has been installed on all servers in the domain using command or powershell?
0
HI,


In O365 how to check the mailbox size of a deleted user?

Thanks
0
Dear Wizards, when I run this script (ps1) to get all members from all Distribution Groups of our Exchange 2016 Server (Win2012R2)

$s = New-PSSession -ConfigurationName microsoft.exchange -ConnectionUri http://mail.domain_name.com/powershell;
Import-PSSession $s;

$groupmember = foreach ($i in Get-DistributionGroup) {Get-DistributionGroupMember $i -ResultSize Unlimited | select Name, PrimarySMTPAddress,@{n='GroupName';e={$i.Name}} ,@{n='GroupSMTP';e={$i.PrimarySMTPaddress}} };
$groupmember | Export-Csv C:\_ListGroupmails.csv -NoTypeInformation;

Remove-Variable groupmember;
Remove-PSSession $s;
pause

Open in new window


I got this error

error.PNG
Can you please help and suggest?  Many thanks as always!
0
Hi Guys

We have a + 50 Gig exchange mailbox that we would like to purge data from it.
We would like to keep 6 months max of current data and purge the rest.

My question I have would be what would be the best way in doing this that will have the least impact to my exchange environment?
IE: Should we look at creating a temp Mailbox moving 6 months of current data there and then moving the e-mail alias to it and trash the old mailbox and then recreate and move alias back?
Is there a PowerShell script that would work better etc.etc. etc.

Using OWA we have noticed that due to the size of the mailbox the server battles and lags when trying to delete mas mail this way.

Regards
R
0
We have a big problem using o365 Exchange.

1. We would like to know any auto-forwarding rule setup by end user themselves on webmail or Outlook
2. We would like to disable their ability setting up auto-forwarding, and only admin staff can do it on server side to prevent data leakage.
3. Is it possible to disable end user using powershell connecting to the o365 changing their mailbox configuration? and only admin account can do for all.
0
Hi,

I'm looking to create a new dynamic distribution list that only includes all my licensed Office 365 users, I have 2000 E3 users but the group is currently sending to 3000+ email addresses as it's including resources + shared mailboxes, can anyone help with creating this via PowerShell?
0
I have  2 questions on o365

1) if we have E3 licenses , and our mailboxes I believe will have 50 GB quota  and emails are sitting there.
so what is the advantage if we use retention policy, if we enable archive against user mailboxes in 365 portal, will user will have archive mailbox populated in his outlook

2) can I have any powershell which I can run to see which mailboxes are idle or in disabled state so I can convert to shared mailboxes

I need to have a list so I can convert them

3) if I have on premise AD and users are syncing through AAD sync to azure AD , I cant make any changes in Azure AD , it wont reflect in on premise AD
1
Hi,

I have restored an O365 user from PowerShell cmd : Restore-MsolUser -UserPrincipalName MyUSer

But after 15-30 min something keep deleting the user again and I need to restore again. What can cause that?
0
Cloud Class® Course: CompTIA Healthcare IT Tech
LVL 12
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Hello Experts,

Need from your expertise in PowerShell to build a script that works in Exchange 2016 and compatible if possible with all versions to delete messages or emails for only the mailboxes in a organization that received that message. We do not want to build the script that search all mailboxes because the organization is huge.

In Exchange 2010, I wrote something like below. Can you please provide me the code for Exchange 2016? Please, if possible add different conditions or options to delete messages, such as subject, body, attachment, reputation if possible, something that can be easily adjusted to any organization without coding too much.

See current code in Exchange 2010

$MSGS = Get-TransportService | Get-MessageTrackingLog -MessageSubject "This is a test" -start '05/17/2018 7:00AM'-EventId Deliver -ResultSize Unlimited
# to get all recipients and then all mailboxes
# to run a search query based on subject
$users = $msgs | select recipients -expandproperty recipients
$mailboxes = $users | sort -unique
$results = $mailboxes | Search-Mailbox -SearchQuery "received:>$('05/04/2018 11:00AM ') and subject:(`"DOC_F5839403`")" -deletecontent -force -SearchDumpster


so to recap, the script should delete the message with the condition above from mailboxes that so far received or get the email with that criteria
0
i need to generate a full AD report on user account details
any powershell script that i can use ?
0
Hi,

How to retrieve the share folder from 3 levels structure onward fron AD OU Structure , business unit and with owner of the individual share folder on the 300 VMs file servers.  

Is there any free powerful software to retrieve the above requirement?
Is there any powershell code can run on 300 VMs file servers?

Ps advice accordingly. Tks
FS.xlsx
0
We need Powershell scripts that help to pull the report for all the ad users who have administrator access.
0
How can I extract specific pst from my mailbox in Exchange 2010?
0
I'm unable to install an application through SCCM, which we initially created using the Admin Studio app manager.
Checking the log, I receive the install error: function failed, setting exit code to 60002.
I'm trying to install Project 2016 (o365) using ODT, and it states the install.xml file is not found.

The line of code in the powershell script to install it is Execute-Process -path "$dirFiles\setup.exe /configure $dirFiles\Files\install.xml"

Where is the $dirFiles variable located?  I don't see it in the powershell script and would like to verify the folder path associated with it.
0
Exchange/AD report from PowerShell

Original Request from my other post

We have several mailboxes in our department and would like a list of the employees that have access to each of Resource Inboxes:. This is a mixed Exchange 2010/2016 on prem organization.

We need to narrow down the scope of the resource mailboxes to a list of 20 resource or shared mailboxes that are listed on a CSV input file or by their aliases or names in AD

We should include the Display name and Department – it would also be helpful to breakout the access (permission type and associated access rights).
Please also make sure to factor in for explicit denies  for the admin accounts, I don’t believe the clients would understand that

The script below was written by one of your colleagues, however the displayname and department columns are not returning any values.

Import-csv 'C:\Scripts\sharedmailboxes.csv' | %{Get-MailboxPermission $_.Alias | Select Identity,User,{$_.AccessRights},@{Name='DisplayName'; Expression={[String]::join(";",((Get-ADUser -identity $_.User).DisplayName))}},@{Name='Department'; Expression={[String]::join(";",((Get-ADUser -identity $_.User).Department))}}} | Export-Csv -NoTypeInformation 'c:\Scripts\resourcembxresults4.csv'


Can someone please look at the script above, and explain why is not returning any values for departments and display name? Please, see attached csv file generated by the script
resourcembxresults4.csv
0
Hi,

Please, I have Excahnge 2013, I want to change the "last name" of 50 mailbox in exchange 2013, when I change the "last name" we need to modify the "SMTP address" and the "routing E-mail Address" and "SIP address":

Example:
First Name : Lucy
Last Name :  Brynn-Ext
SMTP address : Lucy.Brynn-Ext@domain.com
Routing E-mail Address: Lucy.Brynn-Ext@domain.mail.onmicrosoft.com
SIP address : Lucy.Brynn-Ext@domain.com

after modified the last name from "Brynn-Ext" to "Brynn" I need to obtein the following :

First Name : Lucy
Last Name :  Brynn
SMTP address : Lucy.Brynn@domain.com
Routing E-mail Address: Lucy.Brynn@domain.mail.onmicrosoft.com
SIP address : Lucy.Brynn@domain.com

Thx for your help,
0
I am attempting to write an automated uninstall string, same app, multiple versions. I would have preferred to do this via PowerShell but apparently their servers are so old only some of them support it. So I have found a command line way to find the uninstall strings from the registry, but I am not sure how to pass the string to an execute inside of a batch.

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s /f "OpenSSL" | findstr /B ".*UninstallString"
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" /s /f "OpenSSL" | findstr /B ".*UninstallString"
0
ON-DEMAND: 10 Easy Ways to Lose a Password
LVL 1
ON-DEMAND: 10 Easy Ways to Lose a Password

Learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees in this on-demand webinar. We cover the importance of multi-factor authentication and how these solutions can better protect your business!

I have a need for a powershell script that monitors a process for example if I wanted to moinitor the sprint spooler service on a server I like to run a PS script as a task on the server that will check when the spooler stops working , then send me an email that it stopped , then try to restart the service if it failed to restart the service to let me know via email or if it succeeded to restart to let me know it successfully did so. if those options fail I would like the script to restart the server after 10 min. and let me know that the server was restarted. IS that possible?
0
Can someone please explain the difference between Carriage return (`r) and New line (`n) in powershell.
0
I have the short  script here that  prompt error when I run them.

 Get-Content "MYserverList.txt" | % {
Write-Host "Checking $($_) .."
Get-Service -ComputerName | ?{$_.Displayname -match "SQL*"} |%{$_.stop()}
}

However the s script below running fine without error.

Get-Service -ComputerName servername1,servername2,servername3 | ?{$_.Displayname -match "SQL*"}|%{$_.stop()}
0
Hello,

I am trying to add AD computer accounts to a security group. I have servers across multiple domains and I have a txt file that I am wanting to use to populate the AD security group. Can someone please tell me how I would go about doing this. This is what I am working with right now:

foreach ($member in (get content "C:\group 1.txt")) {Add-adgroupmember "Group 1" -members $member -ErrorAction Continue -Verbose}

The script runs but it tells me the members are not in the root domain that I am running this from, which I am aware of but I am trying to tell PowerShell to look in all domains in the forest.... Thanks in advance!!
0
First I want to say that yes, I do know there are tools that already exist that can make this much easier. Unfortunately we don't have that option right now. It is coming in the future, but for now I am trying to get this to work

here is my script so far, pretty simple....

2..100 | % { plink "172.16.15.$_ "}

this is working good for me. This will hit switches in the range of 172.16.15.2 - 172.16.15.100. It allows me to login to our switches all in the PS window and rolls right to the next one in sequence when I type exit, instead of opening up a new putty session every time.

Is there a way I can add my username and password to this so that it automatically logs into the switch for me, versus having to type it in every time? The end goal is I want to add whatever config changes I want to make to the script and have powershell run through all of them and update the config.
0
Hi Experts,

We have several mailboxes in our department and would like a list of the employees that have access to each of Resource Inboxes:. This is a mixed Exchange 2010/2016 on prem organization.

We need to narrow down the scope of the resource mailboxes to a list of 20 resource or shared mailboxes that are listed on a CSV input file or by their aliases or names in AD

Can someone please assist in the creation of this? Need to see type of permissions currently assigned for each person or group to these shared/resource mailboxes

Thanks in advance
0

Powershell

17K

Solutions

8K

Contributors

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.