Using WebDav & RoboCopy to copy docs between Document Libraries - batch-file

I am trying to automate the process of copying documents between SharePoint 2013 document libraries using a RoboCopy job which calls WebDav.
Batch only works if first manual connection operation was conducted on the intranet. As long as the user's session is active, does it work .
This is the command I am running:
robocopy "Source" "Destination" "Log File" /MOV
And these are the error messages I'm receiving:
-Exception Message :Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically.
StackTrace : at system.IO.__Error.WinIOError(Int32, errorCode, String maybeFullPath)
at system.IO.Directory.InternalCreateDirectory(String fullPath, String Path, Object dirSecurityObj, Boolean checkHost)
at system.IO.Directory.InternalCreateDirectoryHelper(String Path, Boolean checkHost)
at system.IO.Directory.CreateDirectory(String Path)**
Any ideas how this can be done?

I had slimier issues with mapping network drives over the internet using WebDav in both Explorer and Robocopy: It would work after a user session was started and the username/password was entered, but it wouldn't save the passwords even when asked to, so would stop working at the next logon. The root cause was two-fold:
1) By design on Windows, You can't save webdav credentials to non-local sites (See this MS KB)
2) You need to add the URL to the local sites list.
As an attempted fix, try this:
1) Create a Multi String Value at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters called AuthForwardServerList
2) Add the URL's you are trying to connect to - using SharePoint, that may be a bit trickier for you to figure out than in my case, but as an example, here's the string I needed to enter:
https://*.[Website].com
http://*.[website].com
*.[Website].com
Optional: while in the WebClient Parameters, you may want to adjust FileSizeLimitInByte (To enable longer downloads before timeout) and [FileAttributesLimitInBytes][Can't link more than two URL's, but it's KB912152] (To support large numbers of files in a folder) - I set mine to:
"FileSizeLimitInBytes"=dword:80000000 (Hex)
"FileAttributesLimitInBytes"=dword:00989680 (Hex)
3) Open Internet Explorer, and click Tools, Internet Options
4) Click the Security Tab, then click Local Internet, then sites
5) Click Advance on local internet settings
6) Enter the full https URL of the site, and click Add, then click Close
7) Click OK, Click OK, then close Internet Explorer
8) Restart the WebClient Service
9) Open Windows Explorer, and click Map Network Drive
10) Pick a drive letter, Enter the folder as the URL, tick Re-connect at Sign-in, and tick Connect using different Credentials. Click OK.
11) Enter the username and password, and tick the remember my credentials box, and click OK
Hope some of that helps.

Related

Azure Active Directory Server 2016 Group Policy Startup Applications (Chrome) not loading on client workstations

Hi I'm trying to implement a Group Policy in our domain that forces Google Chrome to be added to client startup applications. I've added a GPO and added the key:
Computer Configuration > Administrative Templates > System > Logon > Run These Programs at User Logon
In the "Items to run at logon" I've added the path to chrome.exe (with quotes) like so:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
I've then linked to the Object in our Domain's User and Computer OUs.
I've also pushed the update out to clients and confirmed they have updated GP.
However Chrome does not start when users boot into their laptops.
I'm hoping someone can shine a light on what I've done wrong/what I've forgotten to do - any help much appreciated!
Summarize the comment link as a reply to close this issue.
Per duenni1's comment it looks like the most successful way people are reporting is to use the startup folder instead of the logon group policy. "In my opinion the correct solution: use GPP to manage shortcuts in startup menu folder. Simply create a startup shortcuts."
Could throw it in this directory:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
This will launch the program when they login, we do this to force users into our IM client
https://community.spiceworks.com/topic/1369848-run-these-programs-at-user-logon
If you really want this method to work, I'd start troubleshooting here:
1) is there already a GPO in place that will perform Run These Programs at user logon? That may be the winning GPO
GPO Run these programs at user logon not taking effect
2) According to the official docs, no error is a path issue ( I think your usage of quotes is correct but out of curiosity I'd be curious if removing the quotes has a change).
NOTE: If the program does not run, make sure the path is correct. The program does not run (and no error message is displayed) if the path is not found.

C call to NetShareEnum fails with 5 'Access Denied' on Win 10 while same user can browse the SMB shares

We're running Win10 LTS-B.
Using SMB shares and no domain.
The user is able to access the remote share using file explorer.
But the signed executable which runs as the same user
fails with code 5 'access denied' when calling the function "netShareEnum".
The code is a direct copy from the msdn example.
https://learn.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netshareenum
When starting the executable,
The remote systen with the SMB share shows in the Eventlog "security" a successful login, and approx 10 seconds later a logoff entry.(seems triggered by my call)
So something else is wrong.
I dont know where to look next..
I also enabled dcom/ole access- and failure-logging on the remote system in the hope of finding something, but nothing.
I found it ! :) It was because someone pressed [cancel] on the next popup

Setuping DB Navigator(SQLite) for PyCharm

I have not been having luck setting up a connection to SQLite3 through DB Navigator. I have read over the documentation, but it seems to be out of date and doesn't explain how to actually set up a connection. My set up screen doesn't even look like what is pictured in the docs. The built int help doc just errors and says it can't find the document.
When I try to test the connection, I get the error "Database information incomplete or invalid (host, port, database, file)". I have tried host = localhost, port=22(default). There is the option to enable 'Use SSH' but disabling doesn't change the result. There are fields for Username, and Password. I'm not sure what they want in there. Currently I have 'system' and a random password.
Database file(a single field) is the path to the dir that the database is in. The field 'main' I have the name of the database file itself. Driver Source is the default of built-in library.
What fields am I missing or have in wrong? I can connect to this through VS with both SQLite and SQL server, but not PyCharm.
EDIT:
Finally figured it out. Single SQLite has no username or password capability, I needed to leave all of that disabled. In the database field I browsed and navigated to the file and selected the whole file instead of just the dir. The Main field was left empty.
I figured out that the plugin has a bug.
Step 1 - To connect to the databases you need to enable Auto-Commit and Connect Automatically in DB Navigator.
Step 2 - In DB Navigator > Settings > Database files, you need to add the database file's name, to click in the green add button and then press Enter.
If you still get the error but the connection was succesfully, don't worry, it's just a bug.
But if you get the error and you database connection it's not working, you must follow the Step 2 again, but now change the database file's name path, without include the name of the file and press Enter. Open DB Navigator > Settings > Database files again and now put the database file's name, to click in the green add button and then press Enter.
I've read about this problem in 2014, but nowadays this problem is still alive. Maybe, when you put the paths, there's no refresh in the database file's path and the connection can not be established.
I just solved this issue saving the database file in a different folder, it seems like the problem are the space characters (and maybe other special characters) on the path.
For example something like C:\Users\Wile E Coyote\Acme Files\MyDataBase doesn't work, but something like C:\Users\RoadRunner\Beep\MyDataBase works.

Google Drive MD5 checksum for files

I'm not a programmer, just a regular user of Google Drive. I want to see if the files are uploaded correctly. I go through a whole process in the OAuth 2.0 Playground that lists all files, shows the MD5 checksums but also lots of information per file. If I upload a new file it's hard to search for it and verify its md5 checksum.
Is there an easier way (through an app, maybe?) to show/list MD5 checksums for the uploaded files? I wonder why the Details pane doesn't have it, only lists the file size in bytes.
edit: NB these instructions have changed slightly for the v3 API
I've figured out a quick way to get the MD5 checksums of the files uploaded and decided to share it here, too. Log into your Google Drive account, then:
Visit: https://developers.google.com/drive/v3/reference/files/list
Scroll down to the Try it! section.
Change "Authorize requests using OAuth 2.0" from OFF to ON by clicking on it, then select:
https://www.googleapis.com/auth/drive.metadata.readonly
and click Authorize.
Choose your account then click Accept.
Fill in the fields field with:
for v2 API:
items(md5Checksum,originalFilename)
for v3 API:
open "Show standard parameters" in GUI to see fields than
files(md5Checksum,originalFilename)
to only get a list of filenames and MD5 checksums.
Click Execute and you'll open a list with all the files uploaded to Google Drive and their MD5 checksums.
API instructions
Google Developers - OAuth 2.0 Playground:
https://developers.google.com/oauthplayground/
Step 1: Select & authorize APIs:
Expand "Drive API v3".
Enable "https://www.googleapis.com/auth/drive.metadata.readonly".
Click "Authorize APIs".
Click "Allow".
Step 2: Exchange authorization code for tokens:
Click "Exchange authorization code for tokens".
Step 3: Configure request to API:
Enter the "Request URI".
Click "Send the request".
Request URI instructions
All files in folder
Get specific fields of files in a folder:
https://www.googleapis.com/drive/v3/files?q="folderId"+in+parents&fields=files(md5Checksum,+originalFilename)
//
Replace "folderId" with the folder ID.
You can use &fields=files(*) to get all of the file's fields.
Single file
Get specific fields of a file:
https://www.googleapis.com/drive/v3/files/fileId?fields=md5Checksum,+originalFilename
//
Replace "fileId" with the file ID.
You can use &fields=* to get all of the file's fields.
Parsing the JSON response
Open a JavaScript console.
Save the object into a variable.
Map the object.
Copy the result.
Code
var response = {
"files": [
{
"md5Checksum": "0cc175b9c0f1b6a831c399e269772661",
"originalFilename": "a.txt"
},
{
"md5Checksum": "92eb5ffee6ae2fec3ad71c777531578f",
"originalFilename": "b.txt"
}
]
};
var result = response.files.map(function (file) { return (file.md5Checksum + " *" + file.originalFilename); }).join("\r\n");
console.log(result);
copy(result);
Here are three additional, different ways to list md5 checksums.
Install Google Skicka, a command line tool for Google Drive and run skicka ls -ll /
Although the readme file says it's not an official google product it is hosted on google's github account, so I guess it can be trusted.
There is a plugin that lists all files with their checksums in drive's spreadsheet.
Here's my python3 script that I've created for myself. It's mostly copied from google's official examples. You'll need to obtain client_secret.json file and place it in the same directory with the script - here's the instruction how to do it.
Based on: Alex's above answer!
Click the link : https://developers.google.com/drive/v3/reference/files/list
Click the Try it now link in the middle.
( An active window appears in the middle )
Scroll down the left pane in the active window.
Under fields section on the left pane, fill
files(md5Checksum,originalFilename)
Now we will limit access scopes :
(i) leave the Google OAuth 2.0 selected & clear the box against API key.
(ii) Expand Show scopes under Google OAuth 2.0
(iii) Clear all the scopes but keep this one selected:
**https: //www.googleapis.com/auth/drive.metadata.readonly**
Now click EXECUTE in blue.
(A new Google Sign In Window will open)
Use that window to Sign in with the respective google account & click Allow to permit the Google APIs Explorer access files in your google drive.
It's done! A new window will open with the results in lower right code pane. It will
provide the names & md5Checksums for all the files in the respective google
drive account.
Click outside of the active window to close the window & close the Google Drive
API tab. Now you can sign out of the google account if you want!
Combined with XP1 and Alex guides to work in my scenario, to list MD5 for private folders that shared with me
-includeItemsFromAllDrives
-includeTeamDriveItems
-supportsAllDrives
-supportsTeamDrives
Request URI in OAuth 2.0 Playground
https://www.googleapis.com/drive/v3/files?q="folderID"+in+parents&includeItemsFromAllDrives=true&includeTeamDriveItems=true&supportsAllDrives=true&supportsTeamDrives=true&fields=files(md5Checksum%2CoriginalFilename)

silverlight asking to install when it's already installed

Does anyone else have difficulty with this problem? SL is already installed on each of my browsers but, sometimes (not all the time), the browser shows the SL logo asking to install it. Is there a reason this happens even though the website works perfectly at times? When I re-load the page the logo usually goes away and solves the issue.
Thanks!
Often this is a version issue, in that if the silverlight app was compiled against a newer version than what is on your machine, you will get that SL logo. However that doesn't explain why a reload of the page solves your problem.
HKEY_CLASSES_ROOT\AgControl.AgControl does not have READ access fix
Run regedit (start->run->regedit)
Navigate to HKEY_CLASSES_ROOT\AgControl.AgControl (if you get a message that says "AgControl.AgControl cannot be opened. An error is preventing this key from being opened. Details: Access is denied." proceed to the "Taking ownership of the key" section)
Right click and choose "Permissions"
Click "Add"
Either add your windows username or your network username in the the "Enter the object names to select" and click "Check Names". Your name should take the proper format. If it does not try clicking "Advanced" and searching for your username. My windows username was the one I used.
Click OK
Select your new username in the top pane and in the lower pane (Permissions for ) check the Allow box next to Read.
Click OK
Check Silverlight installation in IE by going to http://www.silverlight.net/
Taking ownership of the key (If you're getting access denied errors while trying to set permissions)
You can download the following tool from microsoft to open an
instance of regedit as system:
http://technet.microsoft.com/en-us/sysinternals/bb897553
The following command line will open a "system" regedit:
psexec -s -i regedit
(Note: You have to execute this command line from an "administrator" command
prompt [right-click command prompt and click run as administrator])
Return to step 3 above

Resources