Python – getpass
Use
from getpass import getpass
I was just doing import getpass which will get you a syntax error: invalid syntax
Use
from getpass import getpass
I was just doing import getpass which will get you a syntax error: invalid syntax
Appears you have to have at least the HDMI cable in to be able to view the menu display. I assume it will work with the USB-C that runs power and display but only when you get your device to actually work with the USB-C cable.
My Samsung S8 always saves photos in the format: 20180101_001741 so the year, month and day is at the start. I was grabbing all files off the phone and sticking them in one folder on another drive as back up. Been doing this for several years so now its a mass of over 30k files from several years. Was causing Explorer to take ages to sort. So wanted to move the files to specific folders based on the year. Was taking ages doing manually so, with the help of ChatGPT and Reddit (mainly Reddit & surfingoldelephant) put this together:
<# Get files in the specified folder, ONLY files. #>
$sourceFiles = Get-ChildItem -Path 'F:\PhoneBackup\19 08 2023\SD card\DCIM\Camera' -File
<# Set the backup path. Same as sourcefiles because we get the first 4 characters of the file name and move to that folder. #>
$backupPath = 'F:\PhoneBackup\19 08 2023\SD card\DCIM\Camera'
<# For each $file (variable declared here as its thrown away after) in sourceFiles, set $year to be the first 4 characters of the file name. #>
foreach ($file in $sourceFiles) {
$year = $file.Name.Substring(0, 4)
<# From reading the IO.PATH is a class (so you don't have to write all the code out. This handles folder paths)
The combine takes the two arguements $backupPath and $year and using the IO.Path class, combines them to give a valid
path (IO.Path sorts that) and stores that in $destDirPath #>
$destDirPath = [IO.Path]::Combine($backupPath, $year)
<# Void supress' the output for the following command so you don't see anything
The command creates a new item in the $destDirPath, itemtype is a directory. The -Force just does it without confirmation. #>
[void] (New-Item -Path $destDirPath -ItemType 'Directory' -Force)
<# Move the item from its current path to the destination path.#>
Move-Item -Path $file.FullName -Destination $destDirPath
}
<# Output that script has finished. #>
Write-Host "Finished moving."
The new machine name will be made in the top level of the machines tree. Move it in AD to whatever OU you wish.
The file that is created needs to be transferred onto the C: drive of the new machine.
c:\windows\system32 folder of the new pc and run
Djoin /requestodj /loadfile C:\temp\PD1000provision.txt /windowspath %windir% /localos
Then reboot.
This turn out to be because the VHDX drive I had created on my work laptop, despite being created as an admin, was instantly getting set to write protect for data security reasons.
It would be VERY useful for Microsoft to say “We can’t write to the drive due to it being set to read-only” instead of the meaningless error it spits out.
Also, if running in powershell, make sure the powershell window is running as admin.
I’ve changed my package and notice they had a deal on for new customers. So managed to drop it to £59.99 a year (I always forget to include VAT). Again, any donations would help but regardless, hope to keep the site up & hopefully my random notes are of help to someone.
wmic path SoftwareLicensingService get oa3xoriginalproductkey
The site was always meant to be a place for my notes that others might find useful. Its been up for 12 years now. Over the years the hosting costs have increased and sadly, this is a year I can’t afford it anymore. Its now £95.99 a year to keep it up. Krystal Hosting are the best hosts I’ve found with good customer support but as I’ve made no money from the site (which was never the point) I now can’t afford it myself, I’m sadly going to have to close it.
So archive it while you can. Hopefully, one day when I have spare cash again it will reappear. Another idea, which will probably never happen, is hosting myself but on and off due to electricity costs so it won’t be available 24/7.
If you’ve found the site useful over the years then a small donation could help keep it up. If enough people donated £1 it could stay up.
Last day the site will be up is the 26th October 2022
Another one and I ended up sticking a load of notes on this for myself
Get-Item “\\SERVERNAME\files\All – all general shared files\April 2020 – Rents and service charges\Archive*.pdf” | ForEach-Object {
Rename-Item $_ ($_.Name -replace “-“, ” “) -WhatIf }
So here are my notes on the command.
Get-Item : We’re getting the contents of the folder on SERVERNAME and looking at all files ending in .pdf
We have to put the path in “” because the folder name has spaces.
We then pipe this with the pipe command (cause it looks like a pipe) | to the ForEach-Object loop. The pipe command means you pass the results of what was just to the left of it, to the next command on its right.
ForEach-Object takes each file, from the Get-Item command and with Rename-Item stores each file’s name in the Powershell global variable $_. You use that global variable because its easy, its short (typing wise) and you don’t have to declare it at the top of your script like other variables. So less code. The $_. global variable is built into Powershell.
The $_.Name takes the contents stored in Global Variable $_ and adds it to name with the (in this case) – removed from all the files that had it and replaced with a space. That is what “-” ” ” are. You’re looking for “-” in the file name and replacing with ” ” space.
The whatif is only there so the command doesn’t actually change anything, it just shows what would happen if the command ran, it can be removed once you know the script works.