Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Reply To: Storing file information to compare later

Saving the original XML inside your script file is easy; just use a here-string, like this: $xml = @' <?xml version="1.0"?> <catalog> <book id="bk101"> <author>Gambardella,...

View Article


Reply To: how to modify "Change PC settings" -> Privacy in Win...

I suppose you could always change the registry values directly, if you’re game. For example, to turn off the “Let apps access my name, picture, and other account info” setting, you might do something...

View Article


Foreach – filecopy script help.

Hi all, I’m hoping someone could assist me with part of a script. I need to make a slight amendment but I’m not sure how to. Here is the part I need to change… $CopyDir = “C:\logs” $a = Get-ChildItem...

View Article

Reply To: Storing file information to compare later

Hi Dave. In your example I do not see here-string. I’ll have to look that up, but your idea looks promising. Am I just copying and pasting my XML into the script as in your example?

View Article

Get-Hotfix

I am trying to find the last time Windows update was run on server and report back a list of all servers which need updating. At the moment I am using Get-Hotfix and returning the date of the most...

View Article


Reply To: Storing file information to compare later

The Here-string is surrounded by @’ and ‘@, in this case. (Double-quoted versions also work, if you wanted to be able to expand PowerShell variables and expressions inside it.) Refer to the...

View Article

Reply To: Foreach – filecopy script help.

So obviously $x.Delete() is the part that needs to be changed. In this case we want to do something like this: $CopyDir = “C:\logs” $a = Get-ChildItem $CopyDir foreach($x in $a) { $y = ((Get-Date) –...

View Article

Reply To: Storing file information to compare later

Thanks again Dave. I’m surprised that this was so simple. The output is something to be desired, but it works. Anything else I could use other than compare-object? What I’m doing is something like...

View Article


Reply To: Storing file information to compare later

You basically have two approaches here; you can compare text (which might be awkward if identical nodes are simply in a different order between files), or you can convert those to objects and write...

View Article


Reply To: Foreach – filecopy script help.

I don’t care for the Code tags on these forums either; I always manually surround my code with <Pre> tags instead.

View Article

Reply To: Formatting testing

<pre>

View Article

Reply To: Storing file information to compare later

I will be calling the here-string the “source of truth” I will need to read in a file which will have different values or possibly have added lines. The output from the compare-object does the job,...

View Article

Reply To: Storing file information to compare later

I guess I see three types of differences that can exist between XML files, off the top of my head: Elements (or trees of elements) that exist in one file but not the other. Elements that exist in both...

View Article


Reply To: Foreach – filecopy script help.

Would Remove-Item be of help?

View Article

Reply To: Storing file information to compare later

To start, I think it would be easier to take the path of least resistance. So for now, I’m going to go for just telling me if the XML I’m reading is different from my authoritative source. If it is...

View Article


Reply To: Get-Hotfix

There are a number of articles on the internet about Get-Hotfix and date problems. This seems the best script I have found so far; strangely, I cannot get it to sort on date. Clear-Host Get-HotFix...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Get-Hotfix

That is the script I “borrowed” To use as the centre of my script. I cannot sort it by date either I thought I was going crazy until I read your answer. I would like to hear if anyone else has managed...

View Article


Reply To: Get-Hotfix

Clear-Host Get-HotFix -ComputerName win7 | where-object {$_.hotfixid -ne "file 1"} | Select...

View Article

Reply To: Foreach – filecopy script help.

Hi, I got it to work using the script below. Do you foresee any issue from doing it this way? foreach ($a in Get-ChildItem C:\Output_logs_from_tests) { if ($a.CreationTime -lt...

View Article

Automatic formatting of code for posting on PowerShell.org forums

Hello everyone, As you may know from past experience or from reading the Forums Tips and Guidelines sticky, there are a couple of quirks with the forum software we’re using here related to CODE tags...

View Article
Browsing all 13067 articles
Browse latest View live