Manage Remote Service Using Alternate Credentials?
Jul 19, 2010
I have to admit that I was sceptical it would work... but below is the code. I had to make a minor change to the code you suggested. Whenever I tried IPC$ it would return a 53 result code, even though I'm sure the share exists. So at the suggestion of another website I removed the share and just the computer name and this worked.
I want a supervisor override capability for my application.I want to provide a username login prompt (including domain). If the user is in the approved list and the password correct, show advanced controls.What .NET code / functions allow this?
NOTE: VB.net answers preferred. C# also accepted.
EDIT: the logged in user is not the user authorizing the override.
I am developing a small tool to allow our Windows admins to do stuff like create/delete users, mailboxes and other useful stuff.The current version has to be launched with RunAs as it requires domain admin privileges to do a lot of the stuff. Now, to overcome this I'm trying to incorporate a dialog box that prompts for credentials when the application starts and then uses said credentials throughout the application. I have it working for the AD interaction but one of the tasks the tool needs to do is create folders on a remote server and share them.Is there any way to create folders using alternate credentials? Maybe, once I have the credentials, quit the application and re-launch it with the specified credentials?
I have a program written in VB.net 2003 that are folks run under alternate credentials. Inside the app there is an option to open a UNC path to a network share. We were running Windows XP SP3 and IE6. The code is simple just a call to the explorer.exe with /root,\UNCPath. After installing IE 8 onto the machine this no longer works. Best I can tell the code is still working but now being executed in non interactive mode so nothing opens up. You can however see a new spawned explorer.exe running under the system account for each attempt at opening a UNC Path. Any ideas what IE8 could have done to cause this behavior?
I need to open a folder on a remote server with different credentials in a window (explorer.exe).I managed to do it with no credentials (my credentials), but when I do it with another username and another password than mine, it opens a prompt to enter a username and a password, and it says "access denied".
In the access log on the remote desktop, it says that I tried to connect with my own username, and not the other username I entered. So, the process obviously did not work.
I'm having an issue here with making a WMI connection to a remote machine using specified administrator credentials.I have the WMI code inside a function, I pass it the computer's name and it returns the WMI information that I am requesting as a string (or in this particular case, an integer) from the remote machine. I'm positive it works, and returns the information I need using specified admin username/password. NOW, the issue I am having is related to (it seems) calling this function from a backgroundworker. [code] "Value does not fall within the expected range." I literally have no clue why this would throw that exception, yet when I call this function from lets say just a random button on my form, it works beautifully. The key here is that I need my WMI requests/processing to run in the background.
I've spent alot of time digging thru the forums to research this problem, and to get the right code. I'm wondering now if this is a system configuration problem, or something else with my code.
Firstly, i'll tell you that i've already put the service account on my machine local security policy that says 'allow to act with/as operating system'.
Running this code from an application, it works just fine:
I'm attempting to consume a HTTP Basic Auth Secured PHP WebService using VB.NET. I've so far managed to get 100% perfect integration by adding it as a Web Reference and doing the following:
Dim Credentials = New System.Net.NetworkCredential("username", "password") Dim CredentialCache = New System.Net.CredentialCache() CredentialCache.Add(New Uri(MyWebService.Url), "Basic", Credentials) MyWebService.Credentials = CredentialCache MyWebService.PreAuthenticate = True
I can also successfully add the webservice as a 'Service Reference' and this also works fine, as long as i turn off all HTTP authentication on the SOAP server.
My problem is that I can't find any documented means of sending basic HTTP Auth Credentials when using Service References as opposed to 'Web References'
Am I right in my understanding that 'Web References' are a legacy method of Web Service consumption?
I was able to programmatically launch a service on my development server from a workstation using the ServiceController class with no problems.
When I try to programmatically launch the service on my production server from my workstation, I get an access error which means I do not have rights to run the service with my logged in ID on the workstation.
My question is, is there a way to launch the service using different credentials? I do not see anywhere to input these credentials in the ServiceController class.
I am trying to communicate with a Windows service on a remote machine on the network but i keep getting an exception saying the following: "System.InvalidOperationException: Cannot open Service Control Manager on computer 'machine001'. This operation might require other priviledges. ---> System.ComponentModel.Win32Exception: Access is denied.
When I try to call a [Java] web service from .NET, I am getting what appears to be a security credentials issue. CWWSS5509E: A security token whose type is [http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken] is required.Is it even picking up the credentials that I am trying to pass? At this point, I just want to make contact with the web service and get access. In my example, ServiceReference1 is a generated Web proxy class.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim myLocateProfileBySourceSystemId As New ServiceReference1.locateProfileBySourceSystemId
I have a solution with two applications in it. One is a windows form application that I want to use to set and manage a windows SERVICE application app settings.
For example. The form has the database connection string on it, when updated. The windows service application settings are updated.. I can get it to work for the windows application, but I need to jump boundries to the other application( Windows Service) and update the app settings there.
I'm using asmx web service to lock a folder on remote computer! When I run web service on local machine everything working fine, but when I run it on remote computer nothing happen, folder on remote computer stay unlock! I supose that I need to set security permission for this web service on remote computer, but i don't know where! So, what I need to enable executing this service on remote computer?
I have a problem with service references, I add the reference and use code similar to the one below, in VS my app conects fine to the web service, also it runs fine launching the app directly. But after I created the installer and give to final users to install they can not connect to the web service.
I put together a small app I want to use on my local network for service monitoring across a few of my servers.
I'm using vb.net express 2010 with system.serviceprocess imported The problem I am having is that my code only seems to work locally, and will not retrieve the service data for any server on my network.
For example, my local machine is called "office-pc", and when running the app on it, I get all the service information.
Dim localServices As ServiceController() = ServiceController.GetServices("office-pc") For Each localservice As ServiceController In localServices ComboBox1.Items.Add(localservice.DisplayName) Next
But, if I want the service info from my web server called "casper", I use the same code, but i change the GetServices() parameter like so;
Dim localServices As ServiceController() = ServiceController.GetServices("casper") For Each localservice As ServiceController In localServices ComboBox2.Items.Add(localservice.DisplayName) Next
After a few seconds delay, nothing happens, ComboBox2 remains empty.
It was my understanding that GetServices() would get the local machines service info unless a machine name was specified, which in both cases is true.
So why isn't it working? Do I need to set something up on the network servers first?
Am trying the following to start a windows service
Try Dim myController As New ServiceController("FCR GEFU Server 1", "10.1.1.208") myController.Start() TextBox1.Text = "Service Started" Catch ex As Exception TextBox1.Text = ex.Message End Try
Am getting the following error:Cannot open Service Control Manager on computer '10.1.1.208'. This operation might require other privileges.How should I provide the log in credentials for the remote PC !?
I am writing a vb.net client application that uses a web service to connect to the remote database.So far I am able to connect to the web service and read, add new and delete data from the database. I am having a hard time updating data.
I have a datagridview control that is bound to a dataset retrieved from the remote database using the web service.When a record is edited in the datagridview control, I need the dataset that is bound to that control to be updated and then that updated dataset to be sent to the webservice to update the remote database.
My client code in the btnUpdate_Click event
dim new_ds as new dataset = datagridview1.datasource Dim es As New testwebservice.equipmenttracker 'the web service reference dim msg as string = es.updateequipment(new_ds) messagebox.show(msg)
I've got a webservice called Converter.asmx and I've just noticed that on the remote server I basically can't connect to it. The error that I get: "No connection could be made because the target machine actively refused it 127.0.0.1:49792" and the error occurs where I'm calling the web service (second line below).
Dim webservice As New localhost.Converter results.InnerHtml = webservice.ParseData(txtInput.InnerText, options)
On my localhost it works fine. How can I change the webservice so that it'll work on the remote host as well?
I am using this code to try to connect to a computer/server from my desk top. but keep getting errors The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
Dim options As ConnectionOptions options = New ConnectionOptions()
The conditions are I don't have administrator privilege I want to see the status of a service in remote machine (server)I use the following code (vb.net with framework 2.0) to see the status
Dim sqlSvc As ServiceController Svc = New ServiceController(My.Settings.serviceName, My.Settings.machineName) If sqlSvc.Status.ToString.Equals("Running") Then displayStatus("success", sqlSvc.Status.ToString) Else displayStatus("error", sqlSvc.Status.ToString) End If
When running the code, InvalidOperationException is raised and found out that I need admin right in the server.Can I lookup the status of the service without having admin right in remote machine ?
I am connecting to a web service that returns a dataset that I use as a datasource for a windows client datagridview.
Once a user has made changes to the datagridview record(s), how do I get those changes back to the connected dataset and back to the remote database.
I wrote the sql update function in the service:
Code Snippet from web service
<WebMethod()> _ Public Sub Update_equipment_repair(ByVal repair_id As Int64, ByVal date_entered As DateTime, ByVal date_sent_in As DateTime, ByVal date_returned As DateTime, ByVal damage_description As String, ByVal vendor_id As Int64, ByVal repair_description As String)
[Code]....
This displays the records perfectly and I figured out how to delete and insert records via web service.
writing updates from the datagridview back to the database.
I am writing a small windows client application that accesses data using a web service that returns datasets.When the dataset is returned, a datagridview's datasource is set to the dataset.
My question is, how do I write changes that were made in the datagridview back to the dataset and then back to the remote database.
[Code]...
Now the client snippet that connects to the service and lists the equipment
I have a Vb.Net 4.0 Windows Service.The service is setup to run in DEBUG with generate debug set to pdb-only. Configuration is set to debug.Installer project is set to DEBUG. VS IDE is set to debug.I do a clean build and clean install of the DEBUG version.
I run x64msvsmon.exe on remote machine (W2008 R2 64bit).I attach to the process via workstation (XP PRO 32bit) in VS2010 without issue.Everything is set to debug but I get the infamous message breakpoint will not currently be hit, no symbols are loaded.
vb.net - how to get a service "logon username" setting on a remote machine so far i have this:
Dim localServices As ServiceController() = ServiceController.GetServices("myserver") For Each localservice As ServiceController In localServices ListBox1.Items.Add(localservice.DisplayName & " " & localservice.Status.ToString) Next
Recently working in vb 2010 express. I'm using service-based database which is based on SQL Server. This database will be deployed at the server. Is it possible that multiple vb.net programs, which are installed in remote computers or client computers in the same network, connect to this database simultaneously? Does the service-based database support multiple connections?
i have a Windows service that is hosting a WCF service through net.tcp and this is working great. I have also created a WCF service application. I am trying to add the net.tcp service reference to the service application. Then I add it to the GAC that goes ok but if I try to RegAsm the WCF service application to allow it to be called from Server.CreateObject I get the error:
Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute.
It does not work. I have tried to call it through a class library but this does not work either as the end point is not set correctly.
What appears to be a simple logic implementation is embarassing me each time I try to get it done. I have a very simple task: loop over rows in a DataTable and each time the next row is reached, set a variable alternating between 0 and 1.
Dim the alternatingValue as Integer For Each dr As Data.DataRow In DT alternatingValue = 0 Next
...so, when this loop finishes with this row, I need to set the alternatingValue = 1 Then when the next loop finishes, I need to set the alternatingValue = 0?
one of my forms wont load! it is not underlined in blue or whatever but it keeps giving me a runtime error and i dont know why bc it was working before
Code: Private Sub AddEmployeeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddEmployeeToolStripMenuItem.Click NewEmployee.Visible = True 'throwing the error Me.Enabled = False End Sub
thats how i have been opening my other forms too but just this one gives me this error "An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."
we develop a dll in vb.net and we call that dll in our application .eacgh and every time we register the dll using regasm method.is there is any code for register the dll