S
Samir Ibrahim
vb2008, Vista
Hi all
I had posted this question in 2 forums and still could not find an answer.
I am creating a project which will return (User Name, Domain, PC Name, IP)
I noticed after doing some tests, that some vb command works fine if the exe
is run from UNC "\\server\folder\myexe.exe" and some command gives security
warning error.
I will give you an example of what I am talking about
create 2 project
in the first project put the below in form_load and build it and put the exe
in unc path and run it from another pc (other than your development pc)
text1.Text = Environment.UserName ' Works Fine
in the second prokect put the below in form_load and do as above
text1.Text = Environment.UserDomainName ' Gives secuirity warning or error
"Unhandled exception has occurred in your application, if you click
continue, the application will ignore this error and attemp to continue. If
you click quit, the application will close immediately Index was outside the
bounds of the array"
after this error, if I pressed continue, the form will open with empty
textbox's
If I copy the exe to local hdd, the exe will run fine.
I managed to get User Name, PC Name, IP) I still cannot get the domain to
work, I had tried the below and all giving warning error
txt_Domain.Text =
My.User.CurrentPrincipal.Identity.Name.Split("\")(0).ToString '
txt_Domain.Text = Environment.UserDomainName
wsNet = CreateObject("WScript.Network")
txt_Domain.Text = wsNet.UserDomain
I am asking for 2 things
Q1: What other code I can use to get the domain name?
Q2: Why some vb code works fine from UNC and some don't? Can I add/change
something to prevent the warning from appearing?
Thanks in advance.
Samir Ibrahim
Hi all
I had posted this question in 2 forums and still could not find an answer.
I am creating a project which will return (User Name, Domain, PC Name, IP)
I noticed after doing some tests, that some vb command works fine if the exe
is run from UNC "\\server\folder\myexe.exe" and some command gives security
warning error.
I will give you an example of what I am talking about
create 2 project
in the first project put the below in form_load and build it and put the exe
in unc path and run it from another pc (other than your development pc)
text1.Text = Environment.UserName ' Works Fine
in the second prokect put the below in form_load and do as above
text1.Text = Environment.UserDomainName ' Gives secuirity warning or error
"Unhandled exception has occurred in your application, if you click
continue, the application will ignore this error and attemp to continue. If
you click quit, the application will close immediately Index was outside the
bounds of the array"
after this error, if I pressed continue, the form will open with empty
textbox's
If I copy the exe to local hdd, the exe will run fine.
I managed to get User Name, PC Name, IP) I still cannot get the domain to
work, I had tried the below and all giving warning error
txt_Domain.Text =
My.User.CurrentPrincipal.Identity.Name.Split("\")(0).ToString '
txt_Domain.Text = Environment.UserDomainName
wsNet = CreateObject("WScript.Network")
txt_Domain.Text = wsNet.UserDomain
I am asking for 2 things
Q1: What other code I can use to get the domain name?
Q2: Why some vb code works fine from UNC and some don't? Can I add/change
something to prevent the warning from appearing?
Thanks in advance.
Samir Ibrahim