Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - [ctp] Invoke-WMIMethod

Reply
 
Old 11-10-2007   #1 (permalink)
Thomas Lee


 
 

[ctp] Invoke-WMIMethod


I'm trying to call the Create method on Win32_share using the CTP but
can't think how to call this with multiple paramaters.

Here's where I am now:


$DiskPath = "d:\foo" # share location
$name = "foo" # share name
$type = 0 # disk drive
$maxallowed = 100
invoke-wmimethod -path win32_share -name create -argumentlist $diskpath,
$name, $type, Maxallowed
Invoke-WmiMethod : Type mismatch
At line:1 char:17
+ invoke-wmimethod <<<< -path win32_share -name create -argumentlist
$diskpath, $name, $type, Maxallowed

Clues?
--
Thomas Lee
doctordns@xxxxxx
MVP - Admin Frameworks and Security

My System SpecsSystem Spec
Old 11-10-2007   #2 (permalink)
Shay Levi


 
 

Re: [ctp] Invoke-WMIMethod

Not that I can try it now, but you missed the $ sign Maxallowed:

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com


Quote:

> I'm trying to call the Create method on Win32_share using the CTP but
> can't think how to call this with multiple paramaters.
>
> Here's where I am now:
>
> $DiskPath = "d:\foo" # share location
> $name = "foo" # share name
> $type = 0 # disk drive
> $maxallowed = 100
> invoke-wmimethod -path win32_share -name create -argumentlist
> $diskpath,
> $name, $type, Maxallowed
> Invoke-WmiMethod : Type mismatch
> At line:1 char:17
> + invoke-wmimethod <<<< -path win32_share -name create -argumentlist
> $diskpath, $name, $type, Maxallowed
> Clues?
>

My System SpecsSystem Spec
Old 11-10-2007   #3 (permalink)
Thomas Lee


 
 

Re: [ctp] Invoke-WMIMethod

In message <8766a944d3338c9f1d710282296@xxxxxx>, Shay Levi
<no@xxxxxx> writes
Quote:

>Not that I can try it now, but you missed the $ sign Maxallowed:
Whoops - that was a cut/paste typo, how about this:

PSH [D:\foo\wmi]: $DiskPath = [string] "d:\foo" # share location
PSH [D:\foo\wmi]: $name = [string] "foo" # share name
PSH [D:\foo\wmi]: $type = [uint32] 0 # disk drive
PSH [D:\foo\wmi]: $maxallowed = [uint32] 100 # max allowed to
use this share
PSH [D:\foo\wmi]:
PSH [D:\foo\wmi]: # do it!
PSH [D:\foo\wmi]: invoke-wmimethod -path win32_share -name create
-argumentlist $diskpath, $name, $type
Invoke-WmiMethod : Type mismatch
At line:1 char:17
+ invoke-wmimethod <<<< -path win32_share -name create -argumentlist
$diskpath, $name, $type
PSH [D:\foo\wmi]:
PSH [D:\foo\wmi]: invoke-wmimethod -path win32_share -name create
-argumentlist $diskpath $name $type
Invoke-WmiMethod : A parameter cannot be found that matches parameter
name 'foo'.
At line:1 char:17
+ invoke-wmimethod <<<< -path win32_share -name create -argumentlist
$diskpath $name $type
PSH [D:\foo\wmi]:
PSH [D:\foo\wmi]: invoke-wmimethod -path win32_share -name create
-argumentlist "$diskpath, $name, $type"
Invoke-WmiMethod : Type mismatch
At line:1 char:17
+ invoke-wmimethod <<<< -path win32_share -name create -argumentlist
"$diskpath, $name, $type"
PSH [D:\foo\wmi]:
PSH [D:\foo\wmi]: invoke-wmimethod -path win32_share -name create
-argumentlist @($diskpath, $name, $type)
Invoke-WmiMethod : Type mismatch
At line:1 char:17
+ invoke-wmimethod <<<< -path win32_share -name create -argumentlist
@($diskpath, $name, $type)
PSH [D:\foo\wmi]:


???
--
Thomas Lee
doctordns@xxxxxx
MVP - Admin Frameworks and Security
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Invoke string PowerShell
Can't invoke IE8 anymore VB Script
Invoke-expression vs & PowerShell
Invoke a script PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46