![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | [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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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: 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 Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Invoke string | PowerShell | |||
| Can't invoke IE8 anymore | VB Script | |||
| Invoke-expression vs & | PowerShell | |||
| Invoke a script | PowerShell | |||