I am trying to attach my SQL Server Databases to instance of the server through code. It gives an error that the folder that contains these files does not have 'Full Control' that I need to give by right clicking on the folder, and editing the Securities.
I wish to do it through code. Please advise if it is possible using Netsh command or any other way.
Thanks
You can use xCacls to change NTFS permissions ...
http://support.microsoft.com/kb/318754
"xcacls file name [/T] [/E] [/C] [/G user:perm;spec] [/R user] [/P user:perm;spec [...]] [/D user [...]] [/Y]
where file name indicates the name of the file or folder to which the ACL or access control entry (ACE) is typically applied. All standard wildcard characters can be used. "
The link above gives the rest of the syntax and a couple of examples.
Related
Following the documentation, variables must be set:
[mariadb]
...
ssl_cert = /etc/my.cnf.d/certificates/server-cert.pem
ssl_key = /etc/my.cnf.d/certificates/server-key.pem
ssl_ca = /etc/my.cnf.d/certificates/ca.pem
Translating to windows, as seen in other answers taking precautions for \s and /s escape.
[mariadb]
ssl_cert="C://Users//myUser//MariaDB//SSL_Certs//server-cert.pem"
ssl_key="C://Users//myUser//MariaDB//SSL_Certs//server-key.pem"
ssl_ca="C://Users//myUser//MariaDB//SSL_Certs//ca.pem"
ssl=true
However, after connecting:
show variables like 'have_ssl'; is DISABLED instead of YES.
show session status like 'ssl_cipher'; is empty.
Open services.msc and find the MariaDB service, and take note of the "Log On As" username. Give Read and List folder contents permissions to the "C://Users//myUser//MariaDB//SSL_Certs// directory, to the user name in the "Log On As" column (in my case NETWORK SERVICE).
After this, show variables like 'have_ssl'; was set to YES.
On Windows 10 I am trying to create a soft link to a file through command prompt opened as an Administrator.
mklink "E:\Folder A\Folder B" "E:\Folder A\Folder C\bibliography.bib"
...where I want to create a soft link to bibliography.bib file into a folder B.
This throws me an error Access denied
What could be the reason?
Had to modify my command to
mklink "E:\Folder A\Folder B\bibliography.bib" "E:\Folder A\Folder C\bibliography.bib"
first of all we can create symbolic link from empty directory to file or visa versa - from empty file to directory via FSCTL_SET_REPARSE_POINT - this is legal and will be work. and we can work with target file (or directory) through this symlink. say in case target is file - we can open and read it as file. but any file browser will be incorrect work with such symlink, because it will be use source file attribute FILE_ATTRIBUTE_DIRECTORY - as result try work with file like with directory or visa versa. because this exist sense use only file -> file or directory -> directory symbolic links (the src and target have the same FILE_ATTRIBUTE_DIRECTORY attribute - both have or not have)
also the mklink assume that symbolic link to be created file - yet not exist. internally it use NtCreateFile with FILE_CREATE disposition. as result we got error, if file already exist. if directory already exist and in call NtCreateFile we not use option FILE_DIRECTORY_FILE (mklink use this option when we use /D switch) - we got STATUS_FILE_IS_A_DIRECTORY error. (The file that was specified as a target is a directory and the caller specified that it could be anything but a directory.). but mklink before display error message, first convert it to win32 error code, and it converted to.. ERROR_ACCESS_DENIED. as result we and view Access denied message, despite the error have nothing common with access denied
if we want create symlink to file via mklink, we need select yet not existing file name(path) as symbolic link to be created
I've recently learnt about folding in vim and that you can use :mkview to save the folds in a document. However, vim is trying to save views in the C:\Program Files (x86)\vim\ directory path, which needs Admin privileges to save to... as this is a corporate Win7 work machine, I need to convince vim it wants to save views elsewhere.
Is there a command I need to include in my _vimrc file to get vim to save the views elsewhere? Or another way to control this behaviour?
Set viewdir.
From :help mkview :
When [file] is omitted or is a number from 1 to 9, a name is generated and 'viewdir' prepended.
:help 'viewdir' gives:
*'viewdir'* *'vdir'*
'viewdir' 'vdir' string (default for Amiga, MS-DOS, OS/2 and Win32:
"$VIM/vimfiles/view",
for Unix: "~/.vim/view",
for Macintosh: "$VIM:vimfiles:view"
for VMS: "sys$login:vimfiles/view"
for RiscOS: "Choices:vimfiles/view")
global
{not available when compiled without the |+mksession|
feature}
Name of the directory where to store files for |:mkview|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
I am trying to add a Windows Context Menu item that will let me right click a file in Windows Explorer and click a button Open in Dev Server.
This will then pass the file path of the selected file to a Windows .bat file.
In my .bat file openLocalHostWebBrowser.bat so far I have this code below which wehn ran opens a new tab in my web browser with the supplied URL.
#echo off
start "webpage name" "http://someurl.com/"
So I need help. I know how to add the context menu in Windows Explorer that will run my openLocalHostWebBrowser.bat file when clicked on.
What I need help with is taking that file path that is passed and changing it by removing part of the front of it and prepending my localhost or any URL for that matter, perhaps another one for a production server.
So if the file path passed to my .bat file is like this...
E:\Server\htdocs\labs\php\testProject\test.php
then I need to somehow turn it into this...
http://localhost/labs/php/testProject/test.php
The E:\Server\htdocs\ should be replaced with http://localhost/
I believe your requirement is fixed (E:\Server\htdocs\ should be replaced with http://localhost/). If so, below may help you.
#echo off
set input=%1
Echo.Input was - %input%
set converted=%input:E:\server\htdocs\=http://localhost/%
set converted=%converted:\=/%
echo.Converted to - %converted%
Sample tested output -
D:\Scripts>repl.bat E:\Server\htdocs\labs\php\testProject\test.php
Input was - E:\Server\htdocs\labs\php\testProject\test.php
Converted to - http://localhost/labs/php/testProject/test.php
Cheers, G
I have a VBS script that is to copy a file from an old user profile to a new one, if it exists, but I'm being shown a 'Permission denied' error when using the objFSO.FileExists() method.
To check the file, I map a drive (working fine, and objFSO.FolderExists() checks are working ok) and pass my username/password (I am an admin, so have access to all profiles, but this is even failing on my own profile).
Full scrip is in this pastebin (Line 106 for the code in question), I'd be greatful for some tips. Thanks.
The mapping method with user/password often gives trouble because the script runs in another security context than the user you use to do the mapping. You do need the mapping though to get permission to read the file so the safest to do is use the mapping but afterward use the UNC to access the file, not the path with the driveletter.
So instead of
old_nicknames_file_path = "J:\" & user_name & "\Application Data\Microsoft\Outlook"
use
old_nicknames_file_path = "\\server\d$\__OLD-PROFILES\" & user_name & "\Application Data\Microsoft\Outlook"