Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There turns out to be two ways. The Microsoft API is called IRASrv and is documented here:</p> <p><a href="http://msdn.microsoft.com/en-us/library/cc240176(PROT.10).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc240176(PROT.10).aspx</a></p> <p>Another way is to simply call msra.exe. with password and novice params (e.g. msra.exe /saveasfile testfile thepassword). However that does prompt the user with the password dialog.</p> <p>Here is example code for calling the IRASrv interface and generating a Remote Assistance Connection String.</p> <pre><code>COSERVERINFO si; ::ZeroMemory( &amp;si, sizeof( si ) ); MULTI_QI qi; ::ZeroMemory( &amp;qi, sizeof( qi ) ); HRESULT hr = S_OK; BSTR bstrUserName = SysAllocString(L"jon"); BSTR bstrDomainName = SysAllocString(L""); BSTR bstrPasswordStr = SysAllocString(L"testpass"); // Get the security information entered by the user _bstr_t bstrUser(bstrUserName); _bstr_t bstrDomain(bstrDomainName); _bstr_t bstrPassword(bstrPasswordStr); // Set AuthIdentity SEC_WINNT_AUTH_IDENTITY_W AuthIdentity = { (unsigned short*)bstrUserName, bstrUser.length(), (unsigned short*)bstrDomainName, bstrDomain.length(), (unsigned short*)bstrPasswordStr, bstrPassword.length(), SEC_WINNT_AUTH_IDENTITY_UNICODE }; COAUTHINFO AuthInfo = { RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_DEFAULT, NULL, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, // The authentication level used RPC_C_IMP_LEVEL_IMPERSONATE, (COAUTHIDENTITY*)&amp;AuthIdentity, EOAC_NONE }; si.pAuthInfo = &amp;AuthInfo; si.pwszName = bstrMachineName; qi.pIID = &amp;(__uuidof(RAServerLib::IRASrv)); hr = ::CoCreateInstanceEx( __uuidof(RAServerLib::RASrv), NULL, CLSCTX_REMOTE_SERVER, &amp;si, 1, &amp;qi ); if (FAILED(hr)) { return hr; } CComPtr&lt;RAServerLib::IRASrv&gt; prasrv; hr = qi.pItf-&gt;QueryInterface(__uuidof(RAServerLib::IRASrv), (void**)&amp;prasrv); if (FAILED(hr)) { return hr; } LPWSTR pstr=NULL; hr = prasrv-&gt;raw_GetNoviceUserInfo(&amp;pstr); if (FAILED(hr)) { return hr; } pstr contains the Remote Assistance Connection String (type 2) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload