Powershell Ignoring Quotation Marks?
Jul 20, 2011
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...
[Code]...
View 3 Replies
ADVERTISEMENT
Sep 19, 2010
I need to check if the webpage contains class="listingTitle">
So im using this
If (WebBrowser1.DocumentText.IndexOf("class=""listingTitle"">", StringComparison.InvariantCultureIgnoreCase) > -1) Then
That doesnt work. I tried "class='listingTitle'>", and I tried "class=""listingTitle"">" both dont work.
View 1 Replies
Jun 10, 2011
If have this code which writes the following into a text file. sWriter.WriteLine("a" & " " & A.Text)This is the resulta 45-Id like the text in A.text to be in speech marks, so the final result is something like hisa "45"But I cant seem to quote quoatation marks, it gets all confused.
View 1 Replies
Mar 26, 2011
This is a very beginner question, but driving me crazy. Why isn't this code working?[code]Have also tried using Response.Write() but that doesn't work either.
View 1 Replies
Oct 16, 2009
I have a button and a textbox, the button is linked to an OpenFileDialog and the name of the file is in the textbox.
OpenFileDialog1.ShowDialog()
Dim filename As String = OpenFileDialog1.FileName
Textbox1.Text = filename
How can I make it that the file name is always showed between "" because dos doesn't understand spaces in folders.
View 3 Replies
Aug 9, 2009
Trying to split a line wherever "," appears (with the quotation marks), The problem is VB.NET uses " to start/end strings, so I tried using .Split(""",""") but that then splits it by " not ","
View 4 Replies
Jan 25, 2009
I'm using the following code to read some values in from a tab delimited text file:
vb.net
Using Parser As FileIO.TextFieldParser = My.Computer.FileSystem.OpenTextFieldParser(LogFile, vbTab)
Parser.TextFieldType = FileIO.FieldType.Delimited
Dim comments(0) As String
[Code]...
As you can see I have set the HasFieldsEnclosedInQuotes property to true on the textfieldparser because I want to make sure I capture the data correctly if quotation marks are used. If I set the HasFieldsEnclosedInQuotes property to False then it all works (or at least it doesnt error anyway) but like I said, I need to have that set to true because otherwise if the line contained a tab character within the quote marks then my app would think this was two separate fields and process it incorrectly.
View 4 Replies
Jan 12, 2011
In following code, the usage of the string """ (i.e. a left double quotation mark inside a string) results in a compile error in VB.NET:
StringVar = Replace(StringVar, """, "“")
View 3 Replies
Jan 29, 2011
Is there an Excel text file format (XlFileFormat) to export that will not put quotation marks around strings? I've tried xlTextWindows. Maybe there is an additional setting I'm missing? Most of the time, the datasets I'm exporting are in CSV, but I have a situation where I still want to export with an Excel type (long story) but really it is just a small blob of text. Otherwise, I'd just export to a text file; trying to avoid that for this one case.
[Edit]In this case, I have an Excel workbook with a single worksheet, with one cell (No header) with the text: [Reports]
[Code]...
View 2 Replies
Sep 5, 2010
So, I have a textbox with the following text.
Code:
TITLE"Hello there"
blah blah blah etc...
I want my program to find the TITLE text, and then put the text in the double quotations in a variable.
View 9 Replies
Sep 20, 2011
im trying to get this as a result:
"the person said "hello""
how can i use speach marks inside of speach marks in code?
View 3 Replies
Nov 24, 2010
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.
Imports
System.Management.Automation.Runspaces
Imports
[code]....
View 1 Replies
May 16, 2012
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.
View 1 Replies
Dec 12, 2011
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.
View 2 Replies
Jul 28, 2010
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}
[code].....
View 1 Replies
Jun 4, 2012
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?
View 1 Replies
Mar 29, 2010
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()
[Code].....
View 10 Replies
Feb 25, 2012
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.
View 2 Replies
Feb 25, 2010
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.
View 1 Replies
May 18, 2012
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
[code].....
View 1 Replies
Dec 8, 2010
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:
[Code]...
View 1 Replies
Jul 28, 2010
I'm needing to run scripts from within a vb.net windows app. I've got the scripts running in the background fine;
[Code]...
View 1 Replies
Jun 9, 2011
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.
View 3 Replies
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 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!
View 2 Replies
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):
[Code]...
View 1 Replies
Apr 26, 2011
I have the following powershell script which loads a custom .NET DLL this contains the ScriptResult class, it is intern executed from a VB.NET app.
Add-Type -Path $myLibPath
$result = New-Object TheLibrary.ScriptResult
[code].....
View 2 Replies
Aug 15, 2011
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]
View 4 Replies
Jun 13, 2012
Just a quick question, I want to stop the end users from being able to resize a GUI that I've created.
$objForm = New-Object System.Windows.Forms.Form
$objForm.Text = "ADX v2.1.2.0"
$objForm.minimumSize = New-Object System.Drawing.Size(965,665)
[code].....
View 2 Replies
Apr 1, 2011
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 :
MyPipeline.Commands.Add("get-childitem")
MyPipeline.Commands.Add("get-date")
View 2 Replies
Aug 6, 2010
Assuming i have a winform that has a button called "Create a Quote". Once user clicks it,
a PDF File gets created on desktop. The PDF File has a fixed design/structure e.g. the logo is at the top left corner, the headers are fixed, etc. However, the data it self is pulled from a database.
[Code]...
View 1 Replies