ASP/.NET Modifying Exchange 2k7 Mailboxes With Powershell Execution?
May 8, 2012
I'd like to start off by saying I'm not really a programmer just a sysadmin who likes to dabble (so simple answers would be nice ;) ), I've created a webapp that's used by some less technical folk to do basic administration tasks (User provisioning through our IDM, Updating passwords, Disabling accounts, Editing user details, etc) there's also a couple of exchange functions that are currently handled by exporting a CSV that a separate powershell script processes. I'm trying to bring these powershell functions into the application to reduce complexity but I'm having some trouble.
When I execute the "Add-MailboxPermission" command I get no return output (nor does it apply the change) at all, unless I put no parameters, in which case it throws the expected missing parameters exception (Not scientific but proves it's loading the exchange plugin fine and trying to execute):
I'd like to start off by saying I'm not really a programmer just a sysadmin who likes to dabble (so simple answers would be nice ;) ),I've created a webapp that's used by some less technical folk to do basic administration tasks(User provisioning through our IDM, Updating passwords, Disabling accounts, Editing user details, etc)there's also a couple of exchange functions that are currently handled by exporting a CSV that a separate powershell script processes.I'm trying to bring these powershell functions into the application to reduce complexity but I'm having some trouble.
When I execute the "Add-MailboxPermission" command I get no return output (nor does it apply the change) at all, unless I put no parameters,in which case it throws the expected missing parameters exception (Not scientific but proves it's loading the exchange plugin fine and executing):
private sub cmdMbxFullAccess(sender as object, e as eventargs) Dim psRunSpaceConf As RunspaceConfiguration = RunspaceConfiguration.Create() Dim psConfException As PSSnapInException[code].....
If however I issue a simpler command like "Get-Host | Out-String" I get return output as expected. Thus far I have checked that the user context it's running under has the correct permissions and tried executing the command from the powershell prompt on that server to make sure that there isn't some other external issue I am overlooking.how I can further debug this, it's like the command disappears into the ether never to be heard from again!
I have a project on VS 2005 which was running fine with exchange 2003, now the customer migrated to 2010 and my app. is failing when tries to create mailbox. My app. is console based and its running on windows 2003 and 2.0 .net framework. Exchange 2010 is running on a W2K8 and 3.5 framework. I guess a good option would be to develop a webservice (with VS 2010 for example) but not sure if EWS is able create mailboxes.
We use VB2005, Along with Powershell to manage our exchange infrastructure. VB.Net codes have been compiled to support MIIS2003 Operations. One of the operations require the functions in VB.net to write an output into .csv file. This file receives jibberish characters as input after the functions are executed.
I've been tasked with redeveloping a tool that accesses mailboxes in Exchange, extracts the new emails (and their metadata) and then saves the info in DB. Even a brief perusal of the code shows that it could use some serious re-writing (no use of DirectoryServices for example).
However, from what I can make out the code loads the mailbox being accessed into Outlook and iterates through the mails. Is there a way to access the emails directly? I should point out that, unfortunately, we do not have access to the Exchange servers. They are managed by another department.
I am trying to setup a system where a screen will show all the mailboxes in an outlook system and show all the unread msgs in each mailbox inbox this will need to get the time the msg arrived so this can be checked against service level agrements.what is the best way to go about this i was thinking of having an xml file that would have the mail boxes in and the SLA time it has to be answered by so when it has not been answered it changes color.its mainly how to have it check the many mailboxes inbox i was looking at mapi but heard that the notification only works on the main default mailbox.
I am after some code that read several mailboxes on a particular server on the network and bring me back the date of the last mail within each one. Is this possible ?
Im trying to create an app that will do some funky things with new users/leaving users and apply a load of business requirements around this. After playing about with Powershell forms, ive decided to embedd powershell within a VB.net app.I am using the following code, which is always returning "Nothing", as in no result, which is causing me a real headache. The same code works with Get-QADuser, and Get-Command, just not Get-Mailbox.I will also need to call New-Mailbox and othe commands later on in the proces.
I need to call Powershell commands via my code and I find at least 2 different examples of doing this. I'm wondering what the differences between the methods are and why I would use one as opposed to the other.The first (simpler?) method goes something like this:
[code]...
I also know that with either method I can pipe the command to out-string to make Powershell return strings instead of objects.My question is, which method should I use and why? They both seem the same to me.
I have a file full of last-names separated by commas and then first-names.
Smith,Bob Chicken,Ronald Car,Anastasia
Code: gc permissions.csv|% {$_.split(",")[0]}
I'd like to grab the first character of the first name and then pre-pend it to the string of the last name. The general idea is to find the user ID that's stored in Active Directory, in my company it's the first letter of the first name and then the last name.
Then I'm trying to add these users as read-only on a specific directory.
Running the following code resulting in an HostException;
Public Sub RunPowershellInConsole(ByVal scriptText As String) Dim config = RunspaceConfiguration.Create Dim args() As String = New String() {scriptText}
I took the dive into learning VBScript due to some server side scripts that I work with. During a course I ran into Powershell and did some Google searching. From what I was reading, VBScript is good for legacy applications and Powershell is the way to go for Win7. I did not run into anything telling me of this being true or if its a false statement and VBScript will be used for Win7 and Win8. Should I look into learning Powershell and abort my VBScript for now and just worry about VBScript for legacy systems?
I am trying to create a programma that gathers system data like CPU name and speed and Physical Memory things like that
i succeeded in loading the data i use:
Dim searcher As ManagementObjectSearcher = _ New ManagementObjectSearcher("select * from Win32_Processor") For Each oReturn As ManagementObject In searcher.Get()
I'm evaluating the best approach to implement the following periodic task:
Get some users from SQL Server (2008) and then for each user enable licences in the Cloud (Office 365) using PowerShell.
My first thought was a console-based app in C# or VB.net but now that I realize that running a PS Script remotely using C# can be quite a challenge I'm starting to think in alternatives like perform all the stuff using PowerShell, I guess this is a better approach but I'd like to hear your thoughts on this.
I have to call PS commands from a VB.NET program. This works fine if I'm calling standard PS commands, but if I have to call a command that lives in a 3rd party module I can't seem to make it work. At the PS console I can type Import-Module MyModule and then I can call the commands in that module. I tried the following but it doesn't work, I still can't access my command from within the module:
Dim PowerShell As Management.Automation.PowerShell = PowerShell.Create() Dim PowerShellCommand As New PSCommand() Dim PowerShellCommandResults As Object
I have a Powershell script and no matter what I try it completly ignores any quotation marks in the script. The error occurs when I run the script from my VB.NET code yet, I have been running scripts sucessfully through VB.NET for a while now. For example, my script starts with finding out the server name...
I currently have an ASP.NET programming creating a Powershell CmdLet to create a mailbox in exchange. The issue I'm having is sometimes is fails to create the mailbox because "it can't find" the exchange database I am specifying. So what I'm trying to do is run a Get-Mailbox and then pipe the results to an Enable-Mailbox command. Below is the code I am using to do it:
I'm currently having issues calling a .ps1 file in my vb.net project. The program is supposed to provide a simple way for end users to unlock Active Directory accounts. The vb.net project is simply a text box with a button. Users will type the username of the locked account. When the button is pressed, the program writes whatever is in the text box into a CSV file. The CSV file has a samAccountName column in it. After the file is written to, the program then calls a Powershell script that reads the CSV file and unlocks the account based upon what is in the file.The program does everything it is supposed to except for calling the Powershell script to actually unlock the account. I've tried a Process.Start(filePath) which would open the file, but opened in notepad and didn't execute anything. Right now the program is calling a batch file which is supposed to run the script in Powershell but that attempt also failed.
I wonder if it is possible to write and capture errors when running a script to PowerShell.In my case I am using the following code:[code]' add an extra command to transform the script output objects into nicely formatted strings' remove this line to get the actual objects that the script returns, for example, see the script "Get-Process" returns a collection.[code]
I followed Ziannb article on involking powershell from visual basic. It works great but it doesnt allow me to run scripts with [URL]
- how can i run powershell scripts with arguments from VB
- how can i run one powershell command line at a time from VB. When i use below two command, it pipes the first command to the second one..instead of running them individually :
I am trying to run powershell script from VB and I want to see the output of the script as it is running inside a console application. With my script (shown below) when I run from powershell it shows "Command Sleep Starting" and then waits for 5 seconds and then displays the other text.
However, when I run from VB.NET program, the execution waits for 5 seconds and dumps all the text output at once. It doesn't execute first Write-Output command and then wait and then output as it should.[code]...
I have a core EXE I wrote to serve a series of purposes. Another editor that goes along with it needs to repackage that EXE along with the script that EXE interprets. That is simple enough.
However, I need to give users of this stuff the ability to give that repackaged EXE an icon of their own choosing, but they do not have the source code to manually compile that EXE.
I know some magic with file streams and binary manipulation could do this, but I have the sinking feeling that that's pointlessly doing this the hard way and there may be a better way. Maybe the EXE itself can reset its own app icon per instructions given to it.
I found a CSS file while I was searching for how to create tabs without using images. I came across CSS Tabs 2.0. which serves my purpose.However, now I need to customize it to fit my asp.net page, and I can't seem to be able to get anywhere.The CSS file uses a
<ul and an <li
I am using a Table with <tr> and <td>
This is the sample code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
I have to convert this as stated. I am trying to retrive the next position line in an .txt file based upon a user's integer.Basically retrive the next .txt line from user input to an lbldisplay.
Option Explicit On Option Strict On Option Infer Off Public Class frmMain
since upgrading from 2008 to 2010 i have seen an issue where i pause my vb.net project,modify some code, resume, but the app does not execute the new code, it continues as if nohthing was changedery strange, very frustrating
for example msgbox("1") if i pause my app and change this to