Script for Disabled users in AD

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
Jruzycki
Posts: 2
Last visit: Mon Aug 01, 2022 7:43 am

Script for Disabled users in AD

Post by Jruzycki »

Hey Everyone,
First time poster here. I have been in the IT feild for 10 years and I will be the first to admit that i am woefully behind in learning PS. That being said I have jumped into the deep end of the pool and need some help with a script that was probably beyond my means and experience. Here is what the script is supposed to do:

1.When a user gets disabled in Ad the script will set a date of when to remove the user from AD.
2.When the user gets disabled it needs to give access to their network folder for 30 days to their direct supervisor listed in AD.
3.Once the permissions have been given, An email must be sent to the supervisor.
4.once the 30 days has past, the script is supposed to remove exchange access, delete personal folders and Scan folders and all AD group memberships.

As you can see this script will be a beast for the first time diving into PS. I have the first part done, and most of the second. Part 3 and 4 have me stumped and I could use some help or some sample code to help me.
User avatar
brittneyr
Site Admin
Posts: 1649
Last visit: Mon Mar 18, 2024 1:47 pm
Answers: 38
Been upvoted: 30 times

Re: Script for Disabled users in AD

Post by brittneyr »

Please do not post duplicate questions in different forums.
Brittney
SAPIEN Technologies, Inc.
Jruzycki
Posts: 2
Last visit: Mon Aug 01, 2022 7:43 am

Re: Script for Disabled users in AD

Post by Jruzycki »

My Appologies, I wasn't sure if I had posted to the correct forum. I will not do so in the future.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Script for Disabled users in AD

Post by jvierra »

IT for 10 years. You likely haven't been asked to write code before.

I cannot give you what you ask for as you are asking for someone to design a solution for you. Forums are not good places to ask for design assistance. Forums are useful when you have a specific question about code you have written. Forums are not resourced to provide design and coding consulting.

The two requirements, #3 and #4, have many answers that you can find using your search provider. The exact solution will be highly dependent on the exact details of your system and complete requirements.

I know there are many solutions and examples available because your requirements are nearly exact match to many certification exams, so they have been discussed frequently over the years.

There are hundreds of examples of sending email with PowerShell. There are also hundreds of examples of removing an account from exchange based on the account's expiration date.

If you have coding issues after you finish your requirements analysis and start coding the solutions, then post back and we can be of help. Having a specific question would be the best way to get assistance.
This topic is 1 year and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked