- 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
|
#
¿
Aug 19, 2011 09:53
|
|
- Adbot
-
ADBOT LOVES YOU
|
|
#
¿
May 2, 2024 09:28
|
|
- 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.
|
#
¿
Aug 20, 2011 06:49
|
|
- 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.
|
#
¿
Mar 29, 2012 08:20
|
|
- 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.
|
#
¿
Nov 21, 2012 09:36
|
|
- Mully Clown
- Aug 1, 2004
-
I handle my piss like the great big frilly girls blouse that I am
|
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.
|
#
¿
May 12, 2013 10:56
|
|