jaminben Posted September 17, 2014 Posted September 17, 2014 Don't run it with ISE... I always create a .ps1 file and execute that. I have loads of PS scripts I've created and as long as I test/debug them correctly I've not run into any issues. I don't see it as an issue but I'm no powershell guru. 1
ish Posted September 17, 2014 Posted September 17, 2014 HI Jaminben, Brilliant, worked perfectly as a .ps1 script! Any chance, you can help with me one other thing? Is there a way to get a log file or something that shows whats been deleted etc...... Thanks again, Much appreciated!
jaminben Posted September 17, 2014 Posted September 17, 2014 Can't remember the code off the top of my head but Google "powershell out-file" and add it to your loop... I can supply an example on Friday if you've not sorted it by then. 1
ish Posted September 17, 2014 Posted September 17, 2014 ok, i got the code | Out-File 'C:\results.log' which i have put at the end of the script. it creates the log file, but the file is empty. any ideas? thanks again.
jaminben Posted September 18, 2014 Posted September 18, 2014 Add the below to your loop: $textToLog = "AccountName: " + $_.samaccountname,"`r`nHome Directory: " + $_.HomeDirectory,"`r`nProfile Path: " + $_.profilepath $textToLog | Out-File -Append "C:\yourfilename.log"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now