Email Bitlocker status from users on an MDM - powershell

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.

Related

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"

How can I convert a normal folder under a website in a file share to an application via Powershell?

After trying to use ConvertTo-Application and New-WebApplication, I've had no luck converting a folder to an app when it's located on a network share.
I receive a "Path doesn't belong to 'WebAdministration' provider"
I've scoured the internet trying to find a solution, including several links from stackoverflow.
Basically I'm making a GUI script to create a website, convert folders to webapps, I have two comboboxes for selecting current websites and AppPools. The GUI also let's me create AppPools. The GUI works great, but I'm just trying to get this one feature of it going.
This feature of the script is something that is required by management.
New-WebApplication -Name $Name2 -Site $SiteN -PhysicalPath $Path -ApplicationPool $AppP
(also)
ConvertTo-WebApplication -PSPath "\\domain.local\webstuff\WebSites\Dev\Internet\foldername\scriptdevsite\scriptdevsite2\SiteApp1"
Now, I realize that ConvertTo-WebApplication is for converting Virtual Directories to apps, but I wanted to try this and see if it'll work.
The New-Website command works great, but it makes apps and leaves the folders.
So I'll get scriptdevsite2\SiteApp1\SiteApp1, not going to work.
We have websites that have physical folders that sometimes need to be converted to an application and occasionally removed for testing.
Likely going to have to implement some C# for this, I've been checking into Application Class.
But it's not very helpful, at least not to me.
I'm still new to this site, so if there's anything I'm leaving out, I apologize in advance.
Thank you for your help

Powershell Help, the code i have sends a email out to people, need to save a the data of the code but not as a text file

I am new to powershell and need some help. I have a code which runs everyday and sends an email out to people regarding the server status and other details. What i need to do is save that file as maybe an output file or something so if the customer wants can go in to powershell type in the script command and it comes up with the information thats on the email
Is there a way to do this. This cant be a text file. Has to be something u can type and the data comes up?
please help, thanks in advance
Os
Without code the only definite answer I can give you is using the Out-File command. I do not see why it can't be a txt file (because it's just an email)since data can come up and be typed. You can always Out-File to excel or csv, it really all depends on what you're trying to ask.

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.

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.