Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Mully Clown
Aug 1, 2004

I handle my piss like the great big frilly girls blouse that I am
That error is coming up because it thinks you are trying to do a subtraction.

code:
.sum/1mb - <<<< Computer
At face value you'd think you accidentally did a typo and really meant -computer. What has really happened is that you've mixed up which parameters belong with which Cmdlets. You need to put all the parameters with Get-WmiObject before you can pipe it to Measure-Object.

code:
$mem = (Get-WmiObject -Class Win32_PhysicalMemory -ComputerName $ip -Credential $creds -ErrorAction SilentlyContinue | Measure-Object Capacity -Sum).sum/1MB

Adbot
ADBOT LOVES YOU

Mully Clown
Aug 1, 2004

I handle my piss like the great big frilly girls blouse that I am

Moey posted:

The <<<< Computer part was added in once it errored out.

For the code, I need the | measure-object Capacity -sum as if I just do Get-WmiObject Win32_PhysicalMemory, it brings back a table of stuff that I am not interested in.


I feel like this is getting close, I am just missing something stupid.

$mem = (Get-WmiObject Win32_PhysicalMemory | measure-object Capacity -sum).sum/1mb -Computer $ip -Credential $creds -ErrorAction SilentlyContinue | ForEach-Object {$_.Capacity}

So I was wrong about the inadvertent space. With your line of code I was expecting an "unexpected parameter" type error.

Have you tried the line of code from my previous post? I'm about 98% positive it will work for you.

-Computer, -Credentials and -ErrorAction are all parameters of Get-WmiObject so you must provide those before you can pipe to Measure-Object to do your memory calculation.

Mully Clown
Aug 1, 2004

I handle my piss like the great big frilly girls blouse that I am
I think you're trying to achieve the same end result as this.
code:
$destination =  "$env:userprofile\desktop\mylink.url"
Also looks like the perfect job for group policy preferences.

Mully Clown
Aug 1, 2004

I handle my piss like the great big frilly girls blouse that I am
I would recommend having a look at the NTFSSecurity module. I use it a to track down orphaned SIDs. Probably helpful for what you're after as well.

Mully Clown
Aug 1, 2004

I handle my piss like the great big frilly girls blouse that I am

Red Robin Hood posted:


And then I looked up setting permissions on a folder and hit a brick wall.

Any help would be greatly appreciated!

Additionally, are there any books that I should buy that will get me rolling with this with very little scripting experience?

The permissions handling leaves a lot be desired. This is where I'd leave it up to someone else to do the hard work, use the NTFSSecurity module instead. Though it is still good to get basic idea of the standard functionality.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply