i have a hard drive that i use Bitlocker and was my main drive, but i sold the computer and bought a new one, then i got a case to use this SSD as an external drive.
Almost everything was ok, but there is one specific folder that i cant't access, see or move the Files.
Already tried to Take ownership of the files,to go to security tab and set all permissions for my user and for everyone. Tried with administrator powershell to copy and still nothing, even with -force, all i got is this.
When i use:
cp .\07.jpg c:
Then:
cp : O acesso ao caminho 'E:\Users\andre\Pictures\Dell WebCam Central\pics\07.jpg' foi negado.
In line:1 character:1
cp .\07.jpg c:
+ CategoryInfo : PermissionDenied: (E:\Users\andre\...ral\pics\07.jpg:FileInfo) [Copy-Item], Unauthorized
AccessException
+ FullyQualifiedErrorId : CopyFileInfoItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.CopyItemCommand
Related
WOL works perfectly well via the Router, but that requires logging in to the control and browse trought the menus. I want to wake up the machine with one (double) click.
I tried
https://www.itprotoday.com/compute-engines/q-how-can-i-easily-send-magic-packet-wake-machine-my-subnet
(link from PowerShell - If/Else Statement Doesn't Work Properly)
Running a WOL PowerShell script through a batch file
Both throw Syntax Errors, wether I try them with cmd or the PowerShell.
Bash one-line command to send wake on LAN magic packet without specific tool
probably works in linux, but definitely not on windows
Is there a one-liner for Windows or anything that I can put in a bash batch file that actually works?
edit:
I got the second script to run (rename to .ps1, changed execution policy in PowerShell), but not to work.
Tried https://www.itnator.net/wake-lan-script-wol/ but this throws an exception:
Send-Packet : Ausnahme beim Aufrufen von "Parse" mit 1 Argument(en): "Die angegebene physikalische Adresse ist
ungültig."
In C:\wol-script.ps1:38 Zeichen:1
+ Send-Packet <mac-address>
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Send-Packet
Fehler beim Durchlaufen einer Auflistung: Die Sammlung wurde geändert. Der Enumerationsvorgang kann möglicherweise
nicht ausgeführt werden..
In C:\wol-script.ps1:29 Zeichen:3
+ $Error | Write-Error;
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Collecti...numeratorSimple:ArrayListEnumeratorSimple) [], Runt
imeException
+ FullyQualifiedErrorId : BadEnumeration
https://www.gammadyne.com/cmdline.htm#wol works, and it´s "only" 193K (go-wol is around 5MB).
I will put a batch script around it and then I´m done.
A deep link into the router setup would be smaller, but I guess that the AVM software does not allow that.
Only wish remaining is to hibernate the machine via Magic Packet, but my NIC is probably too old for that. I think I will use PuTTY for that.
Thanks everyone for digging!
we are trying to create a fine grained password policy in ADAC and the "NEW" button is greyed out where we usually click to create a new policy. We are not sure why that happened as it has worked before. We have our DC's all set to the highest function level in both domain and forest to 2016. We have all DC's on server 2016.
We tried to do it in PowerShell with the command:
New-ADFineGrainedPasswordPolicy -name "PASSTEST" -Precedence 1 -MinPasswordLength 15
This is the output we are getting from PowerShell:
We are stuck as we are not sure what happened or how to resolve this. We would like to make fine grain password policy work again.
New-ADFineGrainedPasswordPolicy : The object cannot be added because the parent is not on the list of possible
superiors
At line:1 char:1
+ New-ADFineGrainedPasswordPolicy -name "PASSTEST" -Precedence 1 -MinPa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (CN=PASSTEST,CN=...k12,DC=ca,DC=us:String) [New-ADFineGrainedPasswordPolic
y], ADException
+ FullyQualifiedErrorId : ActiveDirectoryServer:8345,Microsoft.ActiveDirectory.Management.Commands.NewADFineGraine
I have a network share hosted by a server (\SERVER) which is being accessed by other servers/clients.
\\SERVER\SHARE\Folder\File
If I wanted to compress Folder and everything in it, is it possible to do using PowerShell WITHOUT having the files be downloaded to the machine that is running the command?
The files in question are large, and there is not enough room on the C drive to download and compress the files on the client. So for example if I navigated to the network share from the client using Windows File Explorer, and selected the folder to compress, it would start downloading the files to the client and then fail due to insufficient free space on the client.
What about PowerShell's Invoke-Command Option?
I do have the option to Invoke-Command from the client to the server, however, the C drive of \SERVER is to small to handle the request as well. There is a D drive (which hosts the actual \SHARE), which has plenty of space though. I would have to tell PowerShell to compress files on that drive somehow instead of the default which would be the C drive.
Error when running the below PowerShell Command
Compress-Archive -Path "\\SERVER\SHARE\Folder" -DestinationPath "\\SERVER\SHARE\OtherFolder\Archive.zip"
Exception calling "Write" with "3" argument(s): "Stream was too long."
At
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:820
char:29
+ ... $destStream.Write($buffer, 0, $numberOfBytesRead)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IOException
The problem is caused by Compress-Archive's limits. Its maximum file size is 2 GB. Documentation mentions this:
The Compress-Archive cmdlet uses the Microsoft .NET API
System.IO.Compression.ZipArchive to compress files. The maximum file
size is 2 GB because there's a limitation of the underlying API.
As for a solution, compress smaller files, or use another a tool such as 7zip. There's a module available, though manual compression is not that complex. As 7zip is not a native tool, install either it or the Powershell module.
Set-Alias sz "$env:ProgramFiles\7-Zip\7z.exe"
$src = "D:\somedir"
$tgt = "D:\otherdir\archive.7z"
sz a $tgt $src
If the source files are small enough so that a single file will never create an archive larger that the limit, consider compressing each file by itself. An example is like so,
$srcDir = "C:\someidir"
$dstDir = "D:\archivedir"
# List all the files, not subdirs
$files = gci $srcDir -recurse | ? { -not $_.PSIsContainer }
foreach($f in $files) {
# Create new name for compressed archive. Add file path, but
# replace \ with _ so there are no name collisions.
$src = $f.FullName
$dst = "c:\temppi\" + $src.Replace('\', '_').Replace(':','_') + ".zip"
Compress-Archive -whatif -Path $src -DestinationPath $dstDir
}
As a side note: use Enter-PSSession or Inoke-Command to run the script on the file server. There you can use local paths, though UNC paths should work pretty well - those are processed by loopback, so data isn't going through network.
I am trying to use a script that ignores I/O errors on a HD, to copy whatever is good there into another HD.
I found this script here : http://81.165.15.172:1983/blog/2013/06/02/ignoring-device-io-errors-during-copy-with-powershell/comment-page-1/
(https://raw.github.com/DavorJ/PS-ForceCopy/master/Force-Copy.ps1)
that does just that...but i cant get it to work.
I am trying with command :
.\Force-Copy.ps1 -SourceFilePath "I:\Downloads\" -DestinationFilePath "H:\Downloads" -MaxRetries 6
but it gives me this weird error:
F:\SSDU\Desktop\Force-Copy.ps1 : Cannot validate argument on parameter 'SourceFilePath'. The "Test-Path -LiteralPath $_ -Type Leaf" validation script for the argument with value "I:\Downloads\" did not return true. Determine why the validation script failed and then try the command again.
At line:1 char:34
+ .\Force-Copy.ps1 -SourceFilePath "I:\Downloads\" -DestinationFilePath
"H:\Downlo ...
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Force-Copy.ps1], ParameterBind
ingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Force-Copy.ps1
Anyone knows how to use this in win-8 64-bit ?
-Thanks
So, it's not a PowerShell solution, but for getting whatever you can off a dying drive I recommend using Roadkil's Unstoppable Copier. You can download it from the author at:
http://www.roadkil.net/program.php/P29/Unstoppable%20Copier
I have had good success with that one.
Having seen examples of BITS being used to transfer files from http addresses as well as regular windows file shares, I thought I'd test pulling and pushing to/from ftp. I used the below powershell commands:
Start-BitsTransfer `
-Source ftp://username:password#ftp.somewhere.com/file.zip `
-Destination c:\temp\file.zip
Start-BitsTransfer `
-Source c:\temp\file2.zip `
-Destination ftp://username:password#ftp.somewhere.com/file2.zip
In both cases I got the error:
Start-BitsTransfer : Cannot find drive. A drive with the name 'ftp' does not exist.
At c:\temp\bits2ftp.ps1:3 char:1
+ Start-BitsTransfer `
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ftp:String) [Start-BitsTransfer], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand
As such, I assume this isn't possible... however thought I'd post on here in case there is a way to do this (e.g. does it work on certain ftp servers)?
Also posting on here since I've seen no mention of anyone attempting this before, so thought I'd provide a Google hit for the next person to wonder.
So far as I can tell, FTP is not currently supported.
HTTP and HTTPS Download Server Requirements: http://msdn.microsoft.com/en-us/library/aa362846(v=vs.85).aspx
HTTP and HTTPS Upload Server (IIS) Requirements: http://msdn.microsoft.com/en-us/library/aa363130(v=vs.85).aspx