Reply To: Out-File only list last entry in file – Why
If you’re working with strings, you won’t see any difference between Out-File -Append and Add-Content. The main difference is that Out-File works with PowerShell’s Format-* cmdlets, even if you don’t...
View ArticleReply To: Out-File only list last entry in file – Why
It really depends on what you want to do. I tend to mix and match output methods depending on what I’m trying to achieve. If the file is one I’ll keep coming back to I tend to use the *Content...
View ArticleFormat from a Variable
I am trying to format my data once I have saved it in a variable. But I am unable to figure out a way of doing this. Here is my process: $strComputers = "Computer1", "Computer2" $FailOutput =...
View ArticleReply To: Format from a Variable
If you want PowerShell to do that for you, then you need to create a custom object instead of just outputting text. $properties = @{'ComputerName'=$strComputer; 'Status'=$whatever} New-Object -Type...
View ArticleReply To: Format from a Variable
$strcomputers = "computer1", "computer2" $failoutput = "location, state `n" foreach ($strcomputer in $strcomputers) { $test = "$($strcomputer), is online. `n" if (!(test-connection -computername...
View Articleset "FTP Authorization Rules" on virtualdirectory
I am trying to automate the creation of user ftp directories on IIS7 (w2008R2). The desired stucture is like: -ftp root (Allow “ftp users” Read) -usera (virtual folder,Allow “usera” Read,Write) -userb...
View ArticlePowershell v3 on Win7
Hi guys, We all know that we can install Powershell v3.0 (maybe also v4.0 – didn’t test yet) on Win7. But there are a lot of modules missing compared to v3.0 on Win8. This is what I would like to...
View ArticleReply To: Powershell v3 on Win7
Unfortunately, no, they won’t work that way. The new OS cmdlets you’re referring to are all CIM-based cmdlets; they rely on the presence of new WMI namespaces and classes which don’t exist on...
View ArticleReply To: Format from a Variable
Don, Picked up my book. I thought I knew PowerShell pretty good, but now I have been put in my place. ha Thank you again, I will start my read. David D.
View ArticleReply To: Powershell v3 on Win7
You have to differentiate between what is shipped as part of PowerShell (actually Windows Management Framework – PowerShell is becoming a smaller and smaller part of WMF over time) and what ships as...
View ArticleReply To: Remove-Item help
Dave Wyatt wrote: I’d probably do something along these lines: Get-Content "D:\Backups\Pdrive cleanup\files_to_delete.txt" | ForEach-Object { $path = $_ try { Remove-Item -Path $path -ErrorAction Stop...
View ArticleReply To: Remove-Item help
Do you need Verbose, Warning or Debug output in the log file, or only errors? If it’s errors only, you can use the 2>> operator in PowerShell 2.0 (instead of *>> in your example).
View ArticleBest way to product HTML from results
Hello all. I’m doing a general inventory summary report but struggling on how to output these results all to one HTML page. I know i can do objects which might help make this easier, but is it...
View ArticleReply To: Remove-Item help
Unfortunately, it’s not only errors that i would like logged but everything that ‘Remove-Item’ does.
View ArticleReply To: Remove-Item help
I don’t think I’m understanding your question, then. I suggested code which outputs information when Remove-Item successfully deletes something, and when it produces errors, but you went in a...
View ArticleReply To: Remove-Item help
I needed to see the what Remove-Item does. Which is why i used -verbose to which i used *>> operator in order to capture it and output it to text. This is what i get in the text file...
View ArticleReply To: Remove-Item help
I see. I have a logging module which is compatible with PowerShell 2.0, and can be used to capture that Verbose output, over on the TechNet Gallery:...
View ArticleReply To: Best way to product HTML from results
You don’t really mention how you want the HTML formatted, but I’m guessing you want it in a table or similar. If so, I guess you need to either create the HTML manually or create custom objects and...
View ArticleDelete user profiles except admin
I work as an IT assistant in higher education and often have to add/remove software, printers, etc… to classroom computers. When doing this, we have to delete all the user profiles from the local...
View ArticleRemote Service commands – multiple services/servers?
Hey Scripting Experts! I’m trying my 1st script out, well my 1st that I’m trying to write where I haven’t found something online to put it together with. I did find information on how to disable...
View Article