![]() The -Recurse parameter indicates that this cmdlet does a recursive copy. The -Exclude parameter is effective only when the cmdlet includes the contents of an item, such as C:\*, the wildcard character '*' is used to specify the contents of the C: directory. Enter a pattern or a path element, such as *.txt. The value of -Exclude parameter qualifies the -Path parameter. The items that this cmdlet excludes in operation are specified as a string array. The value of -Include parameter qualifies the -Path parameter. The items that this cmdlet includes in the operation are specified as a string array. By default, this parameter is set to True. ![]() The -Container parameter indicates that this cmdlet preserves the container objects during the copy operation. This parameter indicates that this cmdlet copies those items that cannot be changed, such as copying over read-only files or aliases. This parameter is more efficient as the provider applies the filters when the cmdlet gets the object, rather than having Powershell filters the object after they're accessed. The FileSystem provider is the only PowerShell provider that supports the uses of filters. The -Filter parameter specifies a filter to qualify the -Path parameter. To rename the item being copied, given a new name in the value of -Destination parameter. The -Destination parameter is used to specify the path to the new location. There is no character in the cmdlet, which is interpreted as a wildcard. ![]() ![]() Single quotation mark tells the Windows PowerShell that it should not interpret any character as an escape sequence. If the path includes the escape characters, enclose it in single quotation marks. Its value is used exactly as it is typed. The -LiteralPath parameter is used to specify a path of a location. The string array in the -Path parameter is used to specify a path to the items to copy. What may or may not have complicated this is my Java Keystore files, JKS files, do not have file extensions.The -Confirm parameter prompts a confirmation before running the cmdlet. Then I use this later to move the file on the remote server.Ĭopy-Item -path D:\truststore -Destination D:\Temp -Force This will copy to the admin share for the root of D.Ĭopy-Item -path $localtruststore -Destination \$server\d$ -Force I ended up just breaking this in to two e below. I have confirmed that the character referenced in the error is the exact number where the $ symbol is in the destination. I still get illegal character in path., char14 $destinationpath = ("\\" -f $server,$remotepath)īOTH of these work and when I write-host the variable I get the correct \server\d$\programe. I have tried completely building the $destinationpath variable by doing these: $destinationpath = "\\$server\$remotepath" If I manually put the Destination in, the copy works perfectly, so this must be a simple syntax issue. + FullyQualifiedErrorId : System.ArgumentException, + CategoryInfo : NotSpecified: (:), ArgumentException + Copy-Item <<<< $localtruststore -Destination \\$server\$remotepath -Force # THIS LINE CAUSES THE ERROR - I think just because of the $.Ĭopy-Item $localtruststore -Destination \\$server\$remotepath -ForceĪt C:\Users\me\OneDrive\work\scripts\PS\TEST\chat_copy_trustore_to_remote.ps1:46 char:11 $remotepath = "d$\programname\40\server\Openfire\resources\security" # remotepath is actually set by looking at a registry entry, but I am sure it is coming out like this: $outvar = ($outvar -replace '\s','') $localtruststore = "C:\Users\me\OneDrive\work\scripts\PS\TEST\truststore" #outvar is used to build the path and comes from a registry key | Out-String The very start of the path had a space in the front which I did not notice the way I was logging. OK, the real problem was that I was getting the path from a registry entry and then cleaning it with Regex.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |