Adding AD users as an Admin - powershell

Here's the situation. I'm am completely new to PowerShell so use small words...
I have a new user in Active Directory that I need to add to about 100 computers as efficiently as possible. My hope was that I could make a PowerShell script that would add the user either through a login script or remotely. I need to have a bit of precision control over this deployment because we don't want to push this user to every computer in the company.
Can PowerShell help me with this, and if not do you all have some sage advice that could help?

To add a user to the local administrators group using PowerShell:
([ADSI]"WinNT://./Administrators,group").Add("WinNT://your-domain/new-user,user")
Just replace the your-domain and new-user parts of the command with the appropriate values for your environment.

Related

Powershell Script help - Add User and Copy Permissions from Folder

I've tried around a bit, but haven't come up with a good result yet. My powershell skills are also a bit rusty.
What do I have in mind?
I want to read all security groups from a folder. For each security group I search in a domain (Active Directory) for the group and get all users contained in it.
Afterwards I add the user with the same rights again extra to the folder.
Reason: I search for the group or the user in another domain. Both domains are accessible from the same server. The groups will be removed at some point.
How can I do this? I have already tried a bit to read out groups (Get-Acl) etc, but I do not get further.
I do not ask for a complete solution, but just need hints how I could do this. Possibly also how this is then called in Powershell etc.

Powershell Credentials Request Window Size

Powershell Noob here.
I have a basic Powershell script that requests user's credentials and then starts MMC programs for remote administration (example: dsa.msc). No issues with the script.
However, I am not happy with the size of the "Windows Powershell Credentials Request" window. I am using Get-Credential "$env:USERDNSDOMAIN\" but our domain name is pretty long.
What I would like:
(Preferred) Have the the domain name gathered in the script ($env:USERDNSDOMAIN) and the when the user is prompted for credentials; the username field will be empty and the user will only need to type their AD username. OR
Have the credentials be collected WITHIN the powershell window so there is enough room
Any assistance is appreciated. Thank you in advance.
You cannot change the default modal dialog/UI in Windows. If you want this control, you can write your own Winfomr/WPF GUI. deploy that for users to execute.
If you have not done this, use this free tool (though WinForm only - for now)...
Online Powershell Form Designer
...for your first effort at GUI design, but read up on GUI design (Winform and WPF) to know what this is about and the other steps you are going to need to do, to get it to do anything.
Youtube -
'PowerShell gui design'
As for your two bullet points. You are halfway there. Just do this:
Get-Credential "$env:USERDNSDOMAIN\$env:USERNAME"

Assign access to users AAD application powershell or Graph API

I'm trying to give access to users on an application on AAD by powershell or Graph API. I have a list of 60 users and I don't want to do it by hand. I've investigate in AAD cmdleds but I didn't find anything useful for me. Is there any way for doing that?
Thanks a lot.
You can do so through PowerShell with a module from this blog post.
After you download the module, edit it, create a csv file containing your 60 users, run 4 cmdlets and you're done!
(Remember to restart PowerShell if you make an edit to the psm1 module in the middle of a PowerShell session, reimporting doesn't clear the cache.)

Output powershell script from a VBA application depending on values inputted

Here's what I would like to archieve:
I would like to create a basic VBA application in order for people to input values which are eventually ran in a Powershell instance.
In order to so this , I would either like the program to output the values in the form in a prefined script and then the user manualy enters this in powershell or I would like the user to input their office 365 credentials prior to filling in the form and for the application to run the script after the user has filled in the values.
Im wondering which would be best to start work on?
Any help would be greatly appreciated
Thanks
Not sure of the specific details, but most of the time these sort of projects are best done completely in powershell. Consider the following:
$Creds = Get-Credential -Message 'Office 365 Login'
Users get a prompt to enter their credentials in an 'official' Windows dialog box, and you get the creds in powershell form automatically. Your form can be created entirely in powershell using the .NET framework, or even WPF I believe, whichever suits your fancy.

Script to change settings in a program (filemaker pro 11)

Looking for some help here. I do a bit of IT support for an organisation of about 200 people. Most of them use a database program called Filemaker Pro 11. Each user should have their own username that is set under the 'edit' menu -> 'preferences'. The edit menu is on the tool bar at the top of the screen, along with file, view, window etc. like as in MS Word for example.
Each user currently has a default username but the organisation wants everyone changed to a unique username. This means me visiting every machine and manually changing it. I was wondering if it would be possible to write a script to prompt users to make this change the next time they open the system? I'm not new to programming but I've never made a script like this before so wouldn't know where to start. Could anyone point me in the right direction?
There is no way to script that change.
The user name you are referring to is the system (Windows or Mac) user name, and not the FileMaker user account. The default for the system user name is whatever they are logged in to their computer as. So, you could give people unique user names at the system level.
The option that is not default allows the user to change their system name. You can create a script that will open preferences for them, but there is no way to actually change it via a FileMaker script.
What you can do: Use the FileMaker account name instead of system name. The account name is much more reliable, follows the user across computers, is more secure, and best of all is (almost) totally scriptable.
I hope this helps. Sorry that what you want isn't possible inside of FileMaker.