|
You're not describing this correctly at all.
How many machines are involved. Give them names and use ONLY those names to refer to the machines. Do not use "user", use "Client" and "Server". Which machine is local and which is the remote machine?
Member 11916735 wrote: i want to start a script on a server and this script should run the other script on a normal pc.
OK. This describes a user logged into a server, running a script on it that will launch a script on a remote client machine.
What am I missing?
|
|
|
|
|
okay, please let me explain again:
I have one service running on the server (service is running as domain administrator).
this service executes my script.
this script should start another script on a client, wich prompts a msgbox for the currently logged in user.
Due the service (and so also the script) is running as domain administrator, I hope I can use its permissions for the client, no matter wich user is logged in on the client.
I hope everything is clearly for you now.
|
|
|
|
|
That's a LOT better!
Too bad, it's never going to work.
You can launch your process (script) on the remote machine. The problem is, because of security concerns, it's not allowed to put up any kind of user interface. The user on the machine will NEVER see the dialog box or anything that asks for input from the user on the remote machine. I think the security implications of code being launched on a users machine from an unknown remote server are quite obvious.
There is no way to get around this.
What's the purpose of this script running on the remote machine?
|
|
|
|
|
Starting the process as user will not work on Win2012. Getting access Denied and user is an admin
Dim psi As New System.Diagnostics.ProcessStartInfo
psi.UseShellExecute = False
psi.WindowStyle = ProcessWindowStyle.Hidden
psi.Verb = "runas"
|
|
|
|
|
For the last time, you do NOT need the Verb = "runas" line at all. It does nothing in this context.
In what context is this code running? Is it part of a Windows Service? A console app? A Windows Forms app? What?
The code works fine as an admin user. It will NOT work if the user running this code is Local System.
|
|
|
|
|
it's a console app and user is admin user and even if I remove Verb = "runas" still getting the same issue
|
|
|
|
|
OK, now, is the app that you're trying to launch on a network share? If so, Does the user that you're impersonating have access to that share?
What happens if you change the WindowStyle to Normal?
|
|
|
|
|
Maybe this details will help.
SID1 have access to cmd.exe and shares.
SID2 have access to DB .
When I run this I am passing SID2 while accessing cmd.exe under SID1
psi.Domain = Domain
psi.UserName = UserName
Dim pword As New System.Security.SecureString()
For Each c As Char In Password
pword.AppendChar(c)
Next
psi.Password = pword
Settings windows to normal don't help
|
|
|
|
|
No, you're NOT accessing "CMD" as SID1 and as you've been told before, you don't need CMD.EXE. The process you are launching is done as the user you're impersonating. If that user doesn't have access to the shares you're going to get Access Denied.
The process is not created as SID1. It's created as the user you're impersonating. A security context is first created for the user you're impersonating, then CreateProcessAsUser is called in that context to load the executable and setup the process. The problem is that the user you're impersonating cannot load the executable because it doesn't have access to the share where the executable is stored. Access Denied.
You're going to have to grant access to the network location to the user you're impersonating for this to work.
|
|
|
|
|
Upvoted for persistence.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It's not the most accurate description of what happens behind the scenes, but it should be sufficient to get the point across.
|
|
|
|
|
Hi
I have one problem i visual basic 2008
I have one project in avr which send back text after receiving text from UDP terminal
for example Terminal send "Hello" , AVR send answer "Readed"
i have UDP terminal "Hercules" and all works good, but in VB not receive, but is one strange thing , when I open VB program first time, then UDP receive one text "Readed" , because I send one text in "Form1_Load"
also when I send from AVR text every 500ms (without waiting for PC) then all works good and UDP receive all texts,
not receive only when AVR wait for text from PC .
In terminal in Android also all works perfect, only in VB is problem.
can you help me ?
here is listing :
Imports System.Net
Imports System.Net.Sockets
Imports System.Net.EndPoint
Imports System.Text.Encoding
Imports System.Text
Public Class Form1
Dim publisher As New Sockets.UdpClient()
Dim subscriber As New Sockets.UdpClient(8899)
Dim counterAs Int16
Dim ep As IPEndPoint
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
counter+= 1
publisher.Connect(TbTo.Text, TbPort.Text)
Dim subscriber As New UdpClient()
Dim sendbytes() As Byte = ASCII.GetBytes(TbSend.Text & Chr(13))
publisher.Send(sendbytes, sendbytes.Length)
subscriber.Close()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
subscriber.Client.ReceiveTimeout = 3000
subscriber.Client.Blocking = False
ep = New IPEndPoint(0, 8899)
subscriber.Connect("10.10.100.254", 8899)
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Opened" & Chr(13))
subscriber.Send(sendBytes, sendBytes.Length)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Try
Dim rcvbytes() As Byte = subscriber.Receive(ep)
TbRcv.Text = counter & ASCII.GetString(rcvbytes) & vbCrLf
Catch ex As Exception
End Try
End Sub
End Class
|
|
|
|
|
Do you have a code example how to implement BCP or Bulk Insert in .net using .frm files.
|
|
|
|
|
I got something better; it's called documentation[^].
Contains explanation on all the switches and code examples.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I'm new in VBs..
i've got this code:
For i = 0 To 20 Step 1.0
MsgBox "Blubb"& i &"bla"
Next i
and this error:
800A0401
"Statement completion expected"
"Compile error in Microsoft VBScript"
modified 19-Feb-16 6:17am.
|
|
|
|
|
What's with
Hide Copy Code
? Comment that out....
|
|
|
|
|
sry that was a mistake, i don't have this in my code... it was a copy and paste error -.-
now my code is right
|
|
|
|
|
Well, unless it's another copy/paste error, you should space out your &'s
wrong:
MsgBox "Blubb"& i &"bla"
right:
MsgBox "Blubb" & i & "bla"
|
|
|
|
|
okay, thank you
but the error is still comming
it have to be the loop, cause i now only have
For i = 0 To 20 Step 1.0
Next i
and the error is still comming
modified 19-Feb-16 6:45am.
|
|
|
|
|
Well try setting the "step" to just 1 rather than 1.0
Presumably you have defined that as an Integer?
And you can remove the final i after Next.
|
|
|
|
|
i just ignor the step, it doesnt matter if it says "step 1" or nothing, 1 is the default value
|
|
|
|
|
So now you're saying
For i = 0 To 20
Next i
is giving you an error? I don't think so... unless you have not defined the variable i at all.
|
|
|
|
|
This:
Dim i as Integer
for i = 0 To 20
Next
or this
Dim i
for i = 0 To 20
Next
is showing the error
|
|
|
|
|
Well, the first will - you don't DIM variables with the As [type] in VBS. You could try
Dim i%
but other than that, and capitalizing the F in for, which shouldn't really be necessary, I really find it hard to believe that this is where the error really lies.
You need to pin down the exact line.....
|
|
|
|
|
The key point you are missing here is that it is not actually the same error!
If I paste your original code into t1.vbs I get the following error
C:\Temp\t1.vbs(3, 6) Microsoft VBScript compilation error: Expected end of statement Removing the i after the Next fixes that problem (as suggested by @Wombaticus)
If I do the same thing with your first block of code above I getC:\Temp\t1.vbs(1, 7) Microsoft VBScript compilation error: Expected end of statement ...getting rid of the as Integer fixes that one (as suggested by @Wombaticus)
Your second block of code above does not produce anything - neither error nor output. If you were getting an error there are you sure you remembered to save the changes in your editor before attempting to run the script file? We've all done that a few times
However, to get to the point ... See those numbers in brackets in my error messages above that are in bold? They indicate the ROW and COLUMN that the error occurs in - so the error moved from line 3 in the first example to line 1 in the second. Much easier to find the problem when you know that little bit of extra infomation
|
|
|
|