![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | 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 |
My System Specs![]() |
| | #2 (permalink) |
| | 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 |
My System Specs![]() |
| | #3 (permalink) |
| | 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 > > |
My System Specs![]() |
| | #4 (permalink) |
| | 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 >> >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| When a class is both an inherited class of another, and alsoimplements an interface method | .NET General | |||
| win32_pingstatus class / dns class | PowerShell | |||
| Can't connect remotely | Vista networking & sharing | |||
| Instantiate Win32 DLL COM server in Vista's IIS | Vista General | |||
| How to instantiate a COM object using moniker syntax? | PowerShell | |||