icacls Command - What am I doing wrong? - icacls

I am trying to grant calltake1 access to all existing files within this CallRecorder\calls directory
I have tried using this script:
C:>icacls "C:\Users\calltake1\Documents\CallRecorder\calls" /grant
calltake1:(OI)(CI)/F /T
and I keep getting this error message
Invalid parameter "calltake1:(OI)(CI)/F"

Related

Getting error in SQL Server executing get-wmiobject

I am trying to execute following PowerShell query in SQL Server
xp_cmdshell "get-WmiObject Win32_LogicalDisk -AV-RISCVMSQL114 | Format-Table -Property DeviceID,FreeSpace,Size"
After executing this, I am getting error:
'get-WmiObject' is not recognized as an internal or external command,
operable program or batch file.
I want to execute this command in all SQL Servers. It's getting executed on SQL Server 2008, but on SQL Server 2012, it's throwing that error due to version or some PowerShell component is not installed.
Can you to please look at the code and let me know
Try:
xp_cmdshell 'PowerShell.exe -noprofile -command "get-WmiObject Win32_LogicalDisk -AV-RISCVMSQL114 | Format-Table -Property DeviceID,FreeSpace,Size"'
If this doesn't work logon to the server open PowerShell with administrator rights. Type Get-ExecutionPolicy and check that Execution Policy is set to Unrestricted. If it isn't then enter the following, then type 'A' (Yes to All):
Set-ExecutionPolicy Unrestricted
If this still doesn't work try upgrading to at least PowerShell V3. But if this is not possible you can try repair your corrupt PowerShell V2 WMI repository with:
winmgmt /verifyrepository
If repository is found to be inconsistent run Winmgmt /salvagerepository and Winmgmt /resetrepository and verify after each. If it is still inconsistent try the following steps:
Go to Task Manager>> Services >> Open Service >> Windows Management Instrumentation service, and change the start up type to Manual.
Stop the WMI service:
net stop winmgmt
Rename the repository folder (C:\Windows\System32\wbem\Repository) to some else 'Repository_OLD'.
Start the WMI service:
net start winmgmt
Set the service back to auto start.
Failing Re-register all of the dlls and recompile the .mofs in the Wbem directory with the following .bat script and then reboot.
#echo off
sc config winmgmt start= disabled
net stop winmgmt /y
%systemdrive%
cd %windir%\system32\wbem
for /f %%s in (‘dir /b *.dll’) do regsvr32 /s %%s
wmiprvse /regserver
winmgmt /regserver
sc config winmgmt start= auto
net start winmgmt
for /f %%s in (‘dir /s /b *.mof *.mfl’) do mofcomp %%s

BCP unable to open host data file when migrating to Azure

I haver a sample GTFS data file I am attempting to load to Azure. The command I am using is:
bcp %fullTablePath% in %data_dir% -f %format_file% -S %server% -U %username% -P %password% -k -F %first_row%
where the parameters are replaced accordingly.
When I execute the command, I get:
SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 11.0]Unable to open BCP host data-file
This is not a file naming issue because the file is indeed there. If I deliberately spell the file incorrectly, I get the same error. Sounds like a permission issue but who do I grant what permission?
If you see this error in batch file but not from PowerShell check that your
%fullTablePath% or %data_dir% variables are full qualify path/absolute path and not relative path as PowerShell and Batch may have different default path settings which may give you the error of:
Unable to open BCP host data-file

SQL Dump File uploading

I have a bigger sql text file (powerpro.sql --> 350MB) to be uploaded to phpmyadmin database named powerpro-new.
So, I used the following command in windows
C:\mysqldump -uroot -p powerpro-new > "C"\powerpro.sql"
But, received the following error.
'mysqldump' is not recognized as an internal or external command,
operable program or batch file.
What may be the error. Can anyone help me pls?
You should navigate to your mysql installation directory in cmd. The default installation path (MySQL Server 5.6) is:
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqldump.exe -uroot -p powerpro-new > "C"\powerpro.sql"
If you don't know where you installed MySQL server you can search mysqldump file by using following command:
C:\>dir /S /P mysqldump.exe

ORA-12545: Connect failed because target host or object does not exist while connecting through the shell

I am trying to run the sql scripts from shell. My scripts are working fine. It is getting connected to database and applying the sql files. Only thing I am not able to understand is why the below error message is getting logged every time.
Error Message :
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Shell Script:
/opt/ORACLE/app/oracle/product/11.2.0/client_1/bin/sqlplus -s <<eoj >>$LOG_FIL 2>&1
${DBUSER1}/${DBPASS}#${hostBillingDBSID}
#${SQLParm} $RPT_FIL
eoj
try the below.
Shell Script:
#let's include oracle installation in the PATH variable
export PATH=$PATH:/opt/ORACLE/app/oracle/product/11.2.0/client_1/bin
#now just use sqlplus, instead of full path reference.
sqlplus -s ${DBUSER1}/${DBPASS}#${hostBillingDBSID} <<eoj >>$LOG_FIL 2>&1
#${SQLParm} $RPT_FIL
eoj
The user/password(connection string) has to be passed as command line arguments to sqlplus.

WMIC How to pass arguments/ parameters with exe

I want to call exe from remote system using WMIC direct command. for that I prepare one command here
WMIC /NODE:"RemoteSys" /USER:"domain\username" /PASSWORD:"XXXXXXXXX" PROCESS CREATE "C:\Program Files (x86)\Company\Product\productapp.exe"
But issue here is this productapp.exe is expecting an arguments/ parameters like " -p PlantA "
Question here is How to pass it ?
I tried many alternate ways but all fails like:
WMIC /NODE:"RemoteSys" /USER:"domain\username" /PASSWORD:"XXXXXXXXX" PROCESS CREATE "C:\Program Files (x86)\Company\Product\productapp.exe" -p PlantB
Output: Invalid Verb Switch
WMIC /NODE:"RemoteSys" /USER:"domain\username" /PASSWORD:"XXXXXXXXX" PROCESS CREATE "C:\Program Files (x86)\Company\Product\productapp.exe" "-p PlantB"
Output: Invalid format. Hint: = [, ].
Don't know what is paramlist & How to use that.
Can anyone help me here ?
I've had to do something similar with MATLAB. What you could try is opening a command prompt and executing the program with parameters from that command prompt.
WMIC /NODE:"RemoteSys" /USER:"username" /PASSWORD:"XXX" PROCESS CALL CREATE "cmd.exe /c cd C:/Program Files (x86)/Company/Product/ & productapp.exe -p PlantB"