Powershell Credentials Request Window Size - powershell

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"

Related

Email Bitlocker status from users on an MDM

So I've been trying to get this script together. So far, the only working part of it is
Start-Transcript
Get-Date
manage-bde -status c:
Stop-Transcript
I've tried getting the email part of the script to work, using multiple ones I've made and some on the web. However they either specifically require an email SENDER to be listed in the script (I figured maybe I could do something to just read the credentials? But we don't want users to have to press anything.).
I also tried using one to connect to Exchange, and manage/send an email with the log file attached. However, I couldn't get that to work either, was denied access.
Does anyone have an idea on what I can do? I come from Python and have a general idea of Powershell but have barely dug into it. Any help would be greatly appreciated.
EDIT - I need to deploy this on Intune in case anyone was wondering.

Adding AD users as an Admin

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.

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.

Automate Outlook first time opening

I wanted to configure a script that would basically take the opening Outlook 2010 for the first time dialog and accept the defaults. We have an exchange server that is currently running that populates the first time fields with the user's AD information. Basically I wanted to write a script in powershell that would accept the default values that AD has filled in and complete the install. Once the install is complete Outlook will set up a copy of the user's mailbox and all of their mail will be pulled down to the computer.
I have been trying and trying in powershell to accomplish the acceptance of defaults to no avail. Is there any possible way to link a powershell script with outlook and have it accept GUI dialogs?
I have not written any code to do this other than a little initialization script in powershell. I am also a powershell newbie so I know enough to create a com object and call that object so that it can open Outlook but that is as far as I can go.
Can someone please give me some help? Here is what I have but it really doesn't work that well:
$mail = new-object -com Outlook.Application
$namespace = $mail.GetNamespace("MAPI")
$folder = $namespace.GetDefaultFolder("olFolderInbox")
$explorer = $folder.GetExplorer()
$explorer.Display()
I'm not sure how far you've gotten with PowerShell, but review this link.
Consider other Windows GUI scripting engines, they should solve this problem pretty easily - more easily than PowerShell scripting.
Try:
AutoHotkey
AutoIt
I ended up using the WASP snap-in at http://wasp.codeplex.com/. It allows UI automation by finding widows and sending commands to those windows. It is easy to use and makes tasks like mine a lot easier. It is only a 32 bit .dll but it works for Powershell >= 2.0. Thank you all for your helpful comments.