prayank@cloudsentinels
Member
- Joined
- Dec 8, 2014
- Messages
- 5
- Programming Experience
- 1-3
So, I am executing a function which returns some string value in textfields. But, when I am trying to use the textfield value somewhere else; it gets added with some extra spaces and I am not able to achieve the desired task. I have tried Trim() and it didnt help and I have also tried string.replace to replace the white spaces with empty but nothing worked.
And the above code gives me the "save.ps1" file with the below text:
$upn= get-mailbox -Identity test3@r3b37.in | select *userprincipalname*
Set-Msoluser -UserPrincipalName
test3@r3b37.in
-FirstName
tetst3
Desired state: $upn= get-mailbox -Identity test3@r3b37.in | select *userprincipalname*
Set-Msoluser -UserPrincipalName test3@r3b37.in -FirstName test3
VB.NET:
sb.Append("$upn= get-mailbox -Identity " + mailboxpop.TextBox1.Text + " | select *userprincipalname* ")sb.Append(vbNewLine)
Dim fchangecmd As String
Dim upn As String
upn = TextBox1.Text
upn = upn.Replace(" ", String.Empty)
Dim fn As String
fn = TextBox6.Text
fn = fn.Replace(" ", String.Empty)
fchangecmd = "Set-Msoluser -UserPrincipalName" + upn + " -FirstName " + fn
sb.Append(fchangecmd)
sb.AppendLine()
Dim strFilePath = (mydocpath & "\save.txt")
If System.IO.File.Exists(strFilePath) Then
System.IO.File.Delete(strFilePath)
End If
Using outfile As New StreamWriter(mydocpath & "\save.txt")
outfile.Write(sb.ToString())
End Using
strFilePath = (mydocpath & "\save.ps1")
If System.IO.File.Exists(strFilePath) Then
System.IO.File.Delete(strFilePath)
End If
System.IO.File.Move((mydocpath & "\save.txt"), (mydocpath & "\save.ps1"))
And the above code gives me the "save.ps1" file with the below text:
$upn= get-mailbox -Identity test3@r3b37.in | select *userprincipalname*
Set-Msoluser -UserPrincipalName
test3@r3b37.in
-FirstName
tetst3
Desired state: $upn= get-mailbox -Identity test3@r3b37.in | select *userprincipalname*
Set-Msoluser -UserPrincipalName test3@r3b37.in -FirstName test3
Last edited: