I am writing a Powershell script to upload multiple folders and sub folders to the AWS S3 bucket, it is giving the below error. I recreated the same for uploading a single folder and the error remains the same. But when i try to upload files using the -File parameter it is working fine. Could someone help me out here.
Write-S3Object -BucketName my-bucket -Folder "D:\Testfolder" -Key "****/****" -Recurse
-Credential $AWSCreds -Region us-east-1.
Write-S3Object : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Write-S3Object -BucketName teamsite-s3 -Folder "D:\Testfolder\" -Key ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Write-S3Object], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Amazon.PowerShell.Cmdlets.S3.WriteS3ObjectCmdlet
This has been fixed by using the parameter -Keyprefix instead of -Key
This Did not work
Write-S3Object -BucketName my-bucket -Folder "D:\Testfolder" -Key "****/****" -Recurse -Credential $AWSCreds -Region us-east-1.
This Works
Write-S3Object -BucketName my-bucket -Folder "D:\Testfolder" -Keyprefix "****/****" -Recurse -Credential $AWSCreds -Region us-east-1.
Related
Its and windows machine and trying to install Sql Server(unattended) using powershell
Write-Host "`nStarting the install of SQL Server" -ForegroundColor Green
[string]$userName = 'domain\username'
[string]$userPassword = 'xyz'
[securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force
[pscredential]$credObject = New-Object System.Management.Automation.PSCredential ($userName, $secStringPassword)
Start-Process -Filepath "$driveLetter\setup.exe" -ArgumentList "/ConfigurationFile=`"$temp_file_location`"" -Credential $credObject -NoNewWindow -Wait -RedirectStandardOutput $standardOutputFile -RedirectStandardError $errorOutputFile
ERROR:
PS C:\Windows\system32> C:\Users\manish\Desktop\custommain.ps1
domain
eu-west-1
fetching the password from parameter stores
Cleaning the outputfile error
finding and replacing the domains and secrets
writting the content of ini into temp file C:\xyz-softwares\ms-sql-server\scripts\batch-files\temp_ConfigurationFile.ini
Mounting SQL Server Image
Getting Disk drive of the mounted image
Starting the install of SQL Server
Start-Process : This command cannot be run due to the error: The user name or password is incorrect.
At C:\xyz-softwares\ms-sql-server\scripts\powershell\ms-sqlserver-installation.ps1:65 char:2
+ Start-Process -Filepath "$driveLetter\setup.exe" -ArgumentList "/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
SQL Installation Failed Installation with exit code
SQL Installation Failed Installation with exit code
At C:\xyz-softwares\ms-sql-server\scripts\powershell\ms-sqlserver-installation.ps1:72 char:9
+ throw $error_message
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (SQL Installatio... with exit code:String) [], RuntimeException
+ FullyQualifiedErrorId : SQL Installation Failed Installation with exit code
PS C:\Windows\system32>
I have tried with powershell with domain credentials.
Although i have exe file and windows machine is connected with domain
Tried to start process command with domain credetials.
This question already has an answer here:
How to use find -exec in CMake execute_process?
(1 answer)
Closed 1 year ago.
I have a .cmake file and I have a custom target in which I need to add a command to find and sign apk files. I do the following:
add_custom_target(${APK_BUILD_TARGET} ALL
COMMAND find ${APK_DIR} -name "*.apk" -exec jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myKey.keystore -storepass myStorePass -keypass myKeyPass {} myName \;
)
I keep getting the error
find: missing argument to `-exec'
If I execute the command alone, in a console, it works fine. I have the same problem with a simple echo command:
COMMAND find ${APK_DIR} -name "*.apk" -exec echo {} \;
I assume something is missing when doing that in COMMAND of add_custom_target, but what?
EDIT:
This work for echo command but not for jarsigner which still gives the previous error:
COMMAND find ${APK_DIR} -name "*.apk" -exec echo {} +
Following this post
How to use find -exec in CMake execute_process?
I finally got the correct command line:
add_custom_target(${APK_BUILD_TARGET} ALL
COMMAND find ${APK_DIR} -name "*.apk" -exec jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myKey.keystore -storepass myStorePass -keypass myKeyPass {} myName "\;"
)
So with "\;" instead of just \;
I'am trying to export certificates from my personal store to c:drive location using certmgr in script
Does someone know what the command is, or can send me to some website. Thanks alot..
CertMgr /s /r CurrentUser my /put cert1.cer /s /r C:\
The following command saves a certificate with the common name myCert in the my system store to a file called newCert.cer. (certmgr command is certmgr.exe instead of certmgr.msc)
certmgr /add /c /n myCert /s my newCert.cer
Please refer to the below link.
https://learn.microsoft.com/en-us/dotnet/framework/tools/certmgr-exe-certificate-manager-tool
Besides, we could refer to the below Powershell cmdlet, which can export a certificate to a file, the difference between these commands is whether the private key and some other extended properties are exported.
https://learn.microsoft.com/en-us/powershell/module/pkiclient/export-certificate?view=win10-ps
https://learn.microsoft.com/en-us/powershell/module/pkiclient/export-pfxcertificate?view=win10-ps
Here is an example of exporting a certificate to a PFX file.
$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText
Get-ChildItem -Path cert:\localMachine\my\5F98EBBFE735CDDAE00E33E0FD69050EF9220254 | Export-PfxCertificate -FilePath C:\mypfx.pfx -Password $mypwd
I am using following PowerShell script to enable BitLocker on C drive,
$SecureString = ConvertTo-SecureString "ABC123" -AsPlainText -Force
Enable-BitLocker -MountPoint "C:" -EncryptionMethod Aes256 -Password $SecureString
And getting the output,
cmdlet Enable-BitLocker at command pipeline position 1
Supply values for the following parameters:
PasswordProtector:
I tried to pass parameters
Enable-BitLocker -MountPoint "C:" -EncryptionMethod Aes256 Add-BitLockerKeyProtector -Password $SecureString -RecoveryKeyPath "\fileserver\keys" -RecoveryKeyProtector
but still, it's showing errors.
Can anyone have a running script to enable BitLocker?
Find the solution for my question, script to configure BitLocker with password,
$SecureString = ConvertTo-SecureString "123456789" -AsPlainText -Force
Enable-BitLocker -MountPoint "D:" -EncryptionMethod Aes256 -PasswordProtector -Password $SecureString
I would like delete a folder named pdf3.wgt after that .zip content of a folder (where was this pdf3.wgt) and finaly rename it in pdf3.wgt, (with windows PowerShell ISE).
prerequisite: C:\wamp64\www\pdf3\pdf3.wgt file exist
When i run (f5) this scripts created by the PowerShell ISE with module Compress-Archive and Rename-Item:
Remove-Item -Path C:\wamp64\www\pdf3\pdf3.wgt
PS C:\Users\tonys> Compress-Archive -DestinationPath C:\wamp64\www\pdf3\pdf3.zip -Path C:\wamp64\www\pdf3
PS C:\Users\tonys> Rename-Item -NewName pdf3.wgt -Path C:\wamp64\www\pdf3\pdf3.zip
in PowerShell ISE on windows 10 i got this error:
`PS C:\Users\tonys> rmdir C:\wamp64\www\pdf3\pdf3.wgt
PS C:\Users\tonys> Compress-Archive -DestinationPath C:\wamp64\www\pdf3\pdf3.zip -Path C:\wamp64\www\pdf3
PS C:\Users\tonys> Rename-Item -NewName pdf3.wgt -Path C:\wamp64\www\pdf3\pdf3.zip
Get-Process : A positional parameter cannot be found that accepts argument 'Compress-Archive'.
At line:2 char:1
+ PS C:\Users\tonys> Compress-Archive -DestinationPath C:\wamp64\www\pd ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-Process], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand
Get-Process : A positional parameter cannot be found that accepts argument 'Rename-Item'.
At line:3 char:1
+ PS C:\Users\tonys> Rename-Item -NewName pdf3.wgt -Path C:\wamp64\www\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-Process], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand`
Could someone tell me why use module proposed by powershell d'ont work ?
adn why he said to me '
A positional parameter cannot be found that accepts argument ?
'
++
When creating a script by copying from an interactive session do not include the command prompt.
PS C:\Users\tonys> Compress-Archive -DestinationPath C:\wamp64\www\pdf3\pdf3.zip -Path C:\wamp64\www\pdf3
PS is an alias for Get-Process and its arguments bare no resemblance to the rest of the line.