![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | How can you remotely instantiate a WMI class? Hello again, I have a script setup to create a printer locally using WMI, using the following code: $PRINTERCLASS = [WMICLASS]"WIN32_PRINTER" $MYPRINTER = $PRINTERCLASS.CREATEINSTANCE() I know that I can remotely hit wmi via gwmi -comp remotecomputer win32_printer, but I'm not sure how one would go about instantiating an object remotely, since there doesn't seem to be a built-in way to do that with powershell's WMI provider, at least that I can see (I'm still pretty new to all of this). Any help would be much appreciated. Thanks, Janssen |
| | #2 (permalink) |
| Guest | Re: How can you remotely instantiate a WMI class? $printerClass = Get-WmiObject Win32_Printer -ComputerName <ServerNameHere> I suggest reading this... some cool stuff you can do. Get-help Get-WmiObject -full "Janssen" <Janssen@discussions.microsoft.com> wrote in message news:57EDA02D-83F2-4AEF-B6DB-62F9C6DA8669@microsoft.com... > Hello again, > > I have a script setup to create a printer locally using WMI, using the > following code: > > $PRINTERCLASS = [WMICLASS]"WIN32_PRINTER" > $MYPRINTER = $PRINTERCLASS.CREATEINSTANCE() > > I know that I can remotely hit wmi via gwmi -comp remotecomputer > win32_printer, but I'm not sure how one would go about instantiating an > object remotely, since there doesn't seem to be a built-in way to do that > with powershell's WMI provider, at least that I can see (I'm still pretty > new > to all of this). > > Any help would be much appreciated. > > Thanks, > > Janssen |
| | #3 (permalink) |
| Guest | Re: How can you remotely instantiate a WMI class? Brandon, Thanks for the reply. The issue is that if you use gwmi win32_printer, you don't get access to the createinstance() method. You only get access to the printers already in existence. The only way I've found to get access to createintstance is to use [WMICLASS], which doesn't actually give you the real objects, but access to a blank class. However, I did figure out the proper syntax I was looking for, which is: [wmiclass]"\\servername\root\cimv2:win32_printer" Janssen "Brandon Shell" wrote: > $printerClass = Get-WmiObject Win32_Printer -ComputerName <ServerNameHere> > > I suggest reading this... some cool stuff you can do. > Get-help Get-WmiObject -full > > "Janssen" <Janssen@discussions.microsoft.com> wrote in message > news:57EDA02D-83F2-4AEF-B6DB-62F9C6DA8669@microsoft.com... > > Hello again, > > > > I have a script setup to create a printer locally using WMI, using the > > following code: > > > > $PRINTERCLASS = [WMICLASS]"WIN32_PRINTER" > > $MYPRINTER = $PRINTERCLASS.CREATEINSTANCE() > > > > I know that I can remotely hit wmi via gwmi -comp remotecomputer > > win32_printer, but I'm not sure how one would go about instantiating an > > object remotely, since there doesn't seem to be a built-in way to do that > > with powershell's WMI provider, at least that I can see (I'm still pretty > > new > > to all of this). > > > > Any help would be much appreciated. > > > > Thanks, > > > > Janssen > > |
| | #4 (permalink) |
| Guest | Re: How can you remotely instantiate a WMI class? Whoops... I misunderstood your question. )"Janssen" <Janssen@discussions.microsoft.com> wrote in message news:3FBD2670-329F-47CE-8BCA-25B99F95315C@microsoft.com... > Brandon, > > Thanks for the reply. > > The issue is that if you use gwmi win32_printer, you don't get access to > the > createinstance() method. You only get access to the printers already in > existence. The only way I've found to get access to createintstance is to > use [WMICLASS], which doesn't actually give you the real objects, but > access > to a blank class. > > However, I did figure out the proper syntax I was looking for, which is: > [wmiclass]"\\servername\root\cimv2:win32_printer" > > Janssen > > "Brandon Shell" wrote: > >> $printerClass = Get-WmiObject Win32_Printer -ComputerName >> <ServerNameHere> >> >> I suggest reading this... some cool stuff you can do. >> Get-help Get-WmiObject -full >> >> "Janssen" <Janssen@discussions.microsoft.com> wrote in message >> news:57EDA02D-83F2-4AEF-B6DB-62F9C6DA8669@microsoft.com... >> > Hello again, >> > >> > I have a script setup to create a printer locally using WMI, using the >> > following code: >> > >> > $PRINTERCLASS = [WMICLASS]"WIN32_PRINTER" >> > $MYPRINTER = $PRINTERCLASS.CREATEINSTANCE() >> > >> > I know that I can remotely hit wmi via gwmi -comp remotecomputer >> > win32_printer, but I'm not sure how one would go about instantiating an >> > object remotely, since there doesn't seem to be a built-in way to do >> > that >> > with powershell's WMI provider, at least that I can see (I'm still >> > pretty >> > new >> > to all of this). >> > >> > Any help would be much appreciated. >> > >> > Thanks, >> > >> > Janssen >> >> |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PS WMI problem remotely | Thomas Makro | PowerShell | 6 | 03-19-2008 05:07 AM |
| Run Dcpromo remotely | Santhosh | PowerShell | 8 | 01-26-2008 06:01 AM |
| Instantiate Win32 DLL COM server in Vista's IIS | Krygim | Vista General | 0 | 11-25-2007 04:12 AM |
| Printing Remotely | Dan | Vista print fax & scan | 0 | 11-23-2007 11:41 AM |
| How to instantiate a COM object using moniker syntax? | Daymon | PowerShell | 2 | 04-07-2007 01:49 AM |