|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
exe running from uncHi 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 Samir,
The information you are asking for you can find using WMI There is a sample in http://code.msdn.microsoft.com/vbsamples Cor Show quoteHide quote "Samir Ibrahim" <samir.ibra***@wilcopm.com> wrote in message news:B28AF7DA-ABBE-4568-9F95-942AE5311181@microsoft.com... > 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 Hello Cor Ligthert,
Thank you for this site which contain rich and valuable information to me. But as concern my problem, I tried the WMI and it gives correct result if I run the exe from HDD but gives security error when run from UNC. I had given up searching for this and raised the white flag. I will copy the exe to each hdd and end this problem. Thanks. Samir Ibrahim Show quoteHide quote "Cor Ligthert[MVP]" <Notmyfirstn***@planet.nl> wrote in message news:uKp0wNO5JHA.4116@TK2MSFTNGP04.phx.gbl... > Samir, > > The information you are asking for you can find using WMI > > There is a sample in > > http://code.msdn.microsoft.com/vbsamples > > Cor > > "Samir Ibrahim" <samir.ibra***@wilcopm.com> wrote in message > news:B28AF7DA-ABBE-4568-9F95-942AE5311181@microsoft.com... >> 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 > There are restrictions on what you can reference depending on where the executable is hosted. The
server you are referencing in the UNC is not in a zone trusted to reference the requested information. Show quoteHide quote "Samir Ibrahim" <samir.ibra***@wilcopm.com> wrote: >Hello Cor Ligthert, > >Thank you for this site which contain rich and valuable information to me. > >But as concern my problem, I tried the WMI and it gives correct result if I >run the exe from HDD but gives security error when run from UNC. > >I had given up searching for this and raised the white flag. I will copy the >exe to each hdd and end this problem. > >Thanks. > >Samir Ibrahim > >"Cor Ligthert[MVP]" <Notmyfirstn***@planet.nl> wrote in message >news:uKp0wNO5JHA.4116@TK2MSFTNGP04.phx.gbl... >> Samir, >> >> The information you are asking for you can find using WMI >> >> There is a sample in >> >> http://code.msdn.microsoft.com/vbsamples >> >> Cor >> >> "Samir Ibrahim" <samir.ibra***@wilcopm.com> wrote in message >> news:B28AF7DA-ABBE-4568-9F95-942AE5311181@microsoft.com... >>> 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 >>
Sleep function in vb.net
.NET Security .NET Marshalling Optimization - FILETIME conversion Emails getting stuck in Outbox Saving and retrieving WinForm template info RE: Rectangle with rounded corners Launch 9 vb.net app then horzonital window command OnCtlColor() database layer Treeview windowstate save and restore |
|||||||||||||||||||||||