Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Wednesday, December 27, 2017

Powershell/Encryption : simple encryption with symmetric algorithm

Hi Mates,
I was just curious on how to create my personal encryption algorithm. I've read various books but I've never tried to build my own one.
Using Powershell I tried to create something simple, easy to understand and to manipulate in order to re-user, disrupt, change and so on.
There are some comments inside it that explain better what is the logic behind it and what are the "keys" that are part of the entire "process".

I don't want to waste my time creating  Synopsis, Description and so on......at least in this moment, maybe in the future I'll do it (....I know it's better.... :-) )

Anyway try to understand the script referring to the comments inside it.
ah.....it works fine with Powershell 5.0 ($psversiontable.psversion.......everytime I've to review how to check the version via command line ......ahahahahgrsh)
Here you have to code.....


Friday, October 6, 2017

Powershell : migrate Exchange 2010 on-prem mailbox to Office 365 and more.....

Hi Mates,
here below a script that I've used to migrate some users to Office 365.
The script contains a lot of comments that should explain sufficiently what it does during the several steps.
Consider that I had a bunch of needs : change some group membership , change the quota, apply email address policy and so on.
For sure it is amendable but at least it's a decent starting point.

Tuesday, October 3, 2017

Obfuscating Powershell script with Powershell

Hi Mates,
I was intrigued by a book that I was reading about Pen Testing. The author wrote a Python script used, together with other functions, to obfuscate a Powershell script.
Since I love Powershell and I’m trying to learn Python I was just curious to see if I was able to re-create the Python script in Powershell.
On the web there are many example but most of them didn’t work (for me). In fact most of them don’t clean the script from some useless chars (CR, BOM, Comments and so on).
I decided to try….. I’ve learned what is BOM and how to get a raw file at the end of some steps.
If the original file respect some specifications (I’ll illustrate later) the obfuscation should happen without any issue.

Wednesday, September 13, 2017

Powershell --> Powerquick : retrieve event viewer settings and/or search for locked user account

Hi mates,
quick and useful : check event viewer settings as record count, state (full or....) file size and so on.
Additionally below you can find a separate script that allows you to query Event Viewer searching for locked out users.
Nothing more, it's easy to understand and adapt to your needs.
Here you are :



Hope this help.
Bye

Wednesday, March 15, 2017

Brute Force/Random password for an Excel protected file : embryonic Powershell exercise

Hi Mates,
only a brief exercise in Powershell.
I would like to know if it is possible to crack Excel password with this scripting language.
Theoretically YES. Practically this is only another opportunity to learn it better.
You can improve it for sure but it's only a good point from which to start and , maybe, go deeper.....
With more diligence you could be able to convert this script to compare some hash.
This is a random password generator ...it's up to you to decide what is the best approach : if you know some information about the secret you can sight better your target and modify the script to exclude some useless calculation. Otherwise you will have to check N passwords /2.....at least (consider it the average).

Monday, March 6, 2017

Powershell --> Powerquick : force active directory replication from a specific domain controller to the remaining others

Hi Mates,
quick and useful : how many times you needed to replicate an Active Directory change to the entire domain ?.....quickly, without waiting the system times.
The GUI is pretty clear but open the administration tool, expand, right click......and so on.....too long sometime....clearly too long
It happens me every day : someone call me from another site/plant and ask me to make some changes. YES I know that we have some replication priority inside AD, it depends on the value that you are going to change.

Wednesday, March 1, 2017

Powershell --> Powerquick : move disabled users from a group to another


Hi Mates,
quick and useful : how many times you needed to have a clean group because to this specific group there was associated a software usage/number of licenses ?
It happened to me but my need was also to have a trace of the users that were members of this group.
So I started creating a group that hosts all disabled user account that TODAY are not using the software "attached" to the main group, but tomorrow I could need to know if a "returning" user had right to be a part of it......a sort of history.

Wednesday, November 9, 2016

Powershell : retrieve external consultant list and send a report to the related internal reference manager

Hi mates,
few weeks ago a friend asked me to prepare a report that recaps every single external consultant situation.
For "situation" she meant some information that could help her to have a quick view on the status of the account, expiration date and who's internally responsible to "manage" the partner.
Having a lot of project "on going" she wanted to be sure that all nominal accounts have a related internal manager defined.
Since she usually put an expiration date for consultants she wants to be sure that every single manager receive, weekly, a report that
shows what's the current situation.

Monday, October 24, 2016

Powershell --> Powerquick : bulk change DHCP Scope Options

Hi mates,
few months ago a customer asked me to automate some changes on several DHCP server inside his network.
The objective was to change the DNS servers for at least 50 scopes......a lot....and do it manually seemed to be time consuming.
Few things.....nothing special.
Pay attentions that DHCP command in Powershell are available only with Windows 8.1 and Windows 2012.
First of all point a server and obtain the list of Scope ID......then....it's done !!!

Friday, October 21, 2016

Powershell --> Powerquick : search email alias and prepare for Exchange bulk migration

Hi mates,
few days ago a customer asked me to automate some steps of the exchange 2003 --> exchange 2010 migration.
Few things.....nothing special.
Point an OU, extract users list, retrieve their alias and then create the file to feed another part of the script that launch the move request.

Friday, May 13, 2016

Powershell --> Powerquick : change Exchange 2003 user attributes

Hi mates,
a friend asked me if it is possible to manage specific parameters on his OLD Exchange environment.
Manage Exchange 2003 with Powershell is not possible...for sure is not possible as it is, conversely, with Exchange 2007 or newer versions.
So to modify, adjust, handle bunches of stuff you can leverage on Active Directory attributes.
Here below a quick example that shows how to change user quota for a specific group of user...logically if you want to do it with Powershell :

Monday, May 9, 2016

Powershell : HTML report about event viewer errors

Hi mates,
few weeks ago a customer asked me if it was possible to receive, every morning, a sort of report that recaps all errors found in the System and Application log for each single server in the domain.
It's a long task : the script must connect remotely to each single server, analyze and retrieve all these kind of info.
Fortunately he added an important condition : only the Errors of the current day (or the previous if you prefer).
Anyway it remains a sort of "complication" : there are thousands of logs and the script may need hours to examine all.

Tuesday, April 19, 2016

Powershell : retrieve all groups and members in Active Directory

Hi mates,
I needed to extract, few weeks ago, some information from one of my customer's Active Directory.
I was worried about the format.....the final output for this huge information.
Searching and trying I found the way to extrapolate everything I need and write it to Excel in order to provide something that could be filtered, ordered, and so on.
Nothing special.....but useful

Friday, March 18, 2016

Powershell --> Powerquick : get (some) important remote pc info

Hi mates,
here again with a quick Powershell script that could help you during the day by day routine.
Some info to retrieve from a remote pc that could be useful for a massive software installation, to group specific computer with specific software installed, to......it's up to your fantasy.
Obviously you can find thousand of this kind of script on the internet but I feel the need to share, share and share......
Improve it without any limit.....

Thursday, March 17, 2016

Powershell --> Powerquick : change Active Directory attributes for a specific group of users

Hi mates,
quick and dirty tips : change Active Directory user account attributes......I needed to do it for and old Exchange 2003 environment.
Only to give you a fast and reliable solution.....nothing more.
Here you are :

Tuesday, March 15, 2016

Powershell : manipulate Excel files

Hi mates,
I needed to manipulate some Excel files and merge some data with my customer's Active Directory.
The main goals were to :
1. be sure that the files were consistent
2. correct eventual anomalies
3. merge part of its contents with some specific fields of the Active Directory
Theoretically this is something that is usually made in accordance with the HR dept. In particular when they use a system the is totally different or separated from our main directory.
The fact is that for several purposes some fields needs to be populated : for example to assign budget or to split some costs between different sub-companies.

Monday, February 1, 2016

Powershell : share and ACL on servers.......

Hi mates,
I needed to perform some information retrieving for an internal auditing.
I took a chance to review share and permission on all of our servers.
Here below a quick and easy script that exports everything on two separate files easy to import in Excel

Wednesday, January 13, 2016

Powershell : find and move disabled computer account.....Active Directory cleaning

Hi mates,
I needed to perform some active directory cleaning.
The most important consideration about this activity is that most of the modern software are continuously in touch with AD, querying it, retrieving data and so on.

To have a partial clean situation we putted in production another script that disables the computer accounts that do not logon to the domain from 90 days.
Having a lot of disabled computers we would like to optimize also the vertical software that rely in AD.

Thursday, December 3, 2015

Powershell modify active directory user account data

Hi mates,
a customer asked me to do a quick operation on his Active Directory.
Practically the needs were :

1. add into a specific group a list of users retrieved from a TXT file
2. retrieve active directory users members from this group
3. for each user modify the description field for future usage maintaning the old value in case it exists

Tuesday, November 3, 2015

Powershell manage local users and group, nest domain users with domain group and local computer admins

Hi mates,
few months ago one of my customer told me :
"I need to clean a lot of servers in terms of local administrators group. At the sametime I would like to change the method to manage local administrators.....is it possbile to create one group for each single server so I can manage members from AD ?
And what we can do for the current situation ? Is it possible to clean without creating issue ? "
Effectively there were a lot of external partner's account inside these local groups, additionally there were a lot of internal application guys username
Anyway what I needed to do is well explained inside the script.....so enjoy :