Try the following.
$d = [datetime](Get-ItemProperty -Path $source -Name LastWriteTime).lastwritetime
This is part of the item property weirdness. When you run Get-ItemProperty it does not return the value but instead the property. You have to use one more level of indirection to get to the value.
Related Posts:
- Get file version in PowerShell
- “No such file or directory” but it exists
- How do I pause my shell script for a second before continuing?
- How do I split a string on a delimiter in Bash?
- How to execute a program or call a system command?
- In the shell, what does ” 2>&1 ” mean?
- How to run a PowerShell script
- How to run powershell script from .ps1 file?
- Should I put #! (shebang) in Python scripts, and what form should it take?
- Should I put #! (shebang) in Python scripts, and what form should it take?
- Connect-AzAccount – how to avoid azure device authentication?
- How do I concatenate strings and variables in PowerShell?
- PowerShell equivalent to grep -f
- How do you comment out code in PowerShell?
- Setting Windows PowerShell environment variables
- Replace substring in PowerShell
- -bash: syntax error near unexpected token `)’
- Check if a file exists or not in Windows PowerShell?
- PowerShell and the -contains operator
- Splitting a string into separate variables
- How to export data to CSV in PowerShell?
- How do I iterate over a range of numbers defined by variables in Bash?
- How to run an EXE file in PowerShell with parameters with spaces and quotes
- How to set ssh timeout?
- subprocess.Popen(): OSError: [Errno 8] Exec format error in python?
- How to substitute shell variables in complex text files
- sudo: apt-get: command not found
- Prompt for user input in PowerShell
- Using find to locate files that match one of multiple patterns
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How to upgrade PowerShell version from 2.0 to 3.0
- Curl command for https ( SSL )
- “unary operator expected” error in Bash if condition
- How to exclude a directory in find . command
- What does “-ne” mean in bash?
- “sed” command in bash
- Python -How to solve OSError: [Errno 22] Invalid argument
- How to exclude a directory in find . command
- How to reload .bash_profile from the command line?
- What is the purpose of “&&” in a shell command?
- How to generate random number in Bash?
- Shell Script Syntax Error: Unexpected End of File
- How can I pass an argument to a PowerShell script?
- How do I split a string on a delimiter in Bash?
- adb shell su works but adb root does not
- What does \x00 mean in binary file?
- Powershell: A positional parameter cannot be found that accepts argument “xxx”
- What is a list in Bash?
- What does the line “#!/bin/sh” mean in a UNIX shell script?
- Open and write data to text file using Bash?
- Given two directory trees, how can I find out which files differ by content?
- PowerShell ‘Or’ Statement
- adb shell su works but adb root does not
- powershell -Or operator not working
- How to remove the quotes when reading a variable in jq in shell?
- Shell script “for” loop syntax
- How to decode a Base64 string?
- Copy file remotely with PowerShell
- Pseudo-terminal will not be allocated because stdin is not a terminal
- python getoutput() equivalent in subprocess
- How to unzip a file in Powershell?
- Is there a TRY CATCH command in Bash
- Copy-Item is overwriting by default
- How to convert a string to lower case in Bash?
- dquote> result of a execution a program in linux shell
- Using sudo with Python script
- The term ‘nmake’ is not recognized
- Ternary operator in PowerShell
- Upload file to SFTP using PowerShell
- Sorting data based on second column of a file
- Does PowerShell has something like “echo off” and “echo on” trigger?
- How can I test that a variable is more than eight characters in PowerShell?
- zip error – Nothing to do
- C++ Filehandling: Difference between ios::app and ios::ate?
- What does “&” at the end of a linux command mean?
- How to sort an array in Bash
- Run script on mac prompt “Permission denied”
- PowerShell: Comparing dates
- Press any key to continue
- How do I get the current username in Windows PowerShell?
- * failed to open vchiq instance
- how to check which version of nltk, scikit learn installed?
- How to split one string into multiple strings separated by at least one space in bash shell?
- How do I do ‘dir /s /b’ in PowerShell?
- Create Log File in Powershell
- Copy multiple files from one directory to another from Linux shell
- execvp: bad address error
- Using grep and ls -a commands
- How to use sed to extract substring
- Running shell command and capturing the output
- How to get a shell environment variable in a makefile?
- Shell Script: Execute a python program from within a shell script
- Can pm2 run an ‘npm start’ script
- What is the difference between double and single square brackets in bash?
- What is “-bash: !”: event not found”
- Sometimes PowerShell stops sending output until I press enter. Why?
- Colors in bash after piping through less?
- In a PowerShell script, how can I check if I’m running with administrator privileges?
- What is the literal escape character in Powershell?
- Is there a way to do a remote “ls” much like “scp” does a remote copy?