Powershell 2.0 cmdlet question

paulgswansonpaulgswanson Member Posts: 311
Do any of you Powershell Guru's out there know if there is a Powershell 2.0 equivalent for these tools?
Get-Device
Get-Driver
Get-Numa
Enable-Device
Disable-Device

I know they are present in 3.0 but thats not an option nor is Dev-con. Bottom line is we need to disable a spcific device id remotly. Any help would be greatly appreciated.
http://paulswansonblog.wordpress.com/
WGU Progress: B.S. Network Management & Design <- I quit (got bored)

Comments

  • QordQord Member Posts: 632 ■■■■□□□□□□
    What is the device? If you can get to it with wmi, then PS can probably disable it.
  • paulgswansonpaulgswanson Member Posts: 311
    When you refer to WMI, am I correct in assuming that is the same as WinRM?
    I'm trying to disable a secondary video driver. Theres to many machines affected to correct by hand.
    http://paulswansonblog.wordpress.com/
    WGU Progress: B.S. Network Management & Design <- I quit (got bored)
  • QordQord Member Posts: 632 ■■■■□□□□□□
    Nah, not really the same, but I don't comprehend the difference. We'll need a real developer to come in and do that. :D You want to remove the driver altogether? This looks like it should work.

    You could try this powershell:
    Get-WMIObject -query "Select * From win32_pnpsigneddriver Where DeviceID='Dell2350dnLaserPrinterPS3'" | Remove-WmiObject

    Replace "Dell2350dnLaserPrinterPS3" with your device ID. This is assuming your device shows up under the plug n play signed drivers. You can check by running this:
    gwmi Win32_PnPSignedDriver | select devicename,deviceid

    Disclaimer: I'm still very new to PS. Just sayin'.
  • paulgswansonpaulgswanson Member Posts: 311
    Qord that would have worked perfectly but theres a policy in affect (apparently) that instantly disables winRm. I verified this by manually attempting to launch winRm service. "this service was started buty then stopped, this occurs sometimes when services are not in use but will be started when required"

    Thx for the great help, saddly this looks like a manualy process this time.
    http://paulswansonblog.wordpress.com/
    WGU Progress: B.S. Network Management & Design <- I quit (got bored)
  • ptilsenptilsen Member Posts: 2,835 ■■■■■■■■■■
    You are going to want to learn WMI. PowerShell's usefulness will always be limited by whatever cmdlets are created.

    Generally speaking, the only way to duplicate a 3.0-only cmdlet on 2.0 or 1.0 is to make WMI or other system calls. It's less work than in literally any other language IMO, so it is not so bad.

    If this is something you are going to do regularly, it may well be worth the time to duplicate PS 3.0's cmdlet functionality. The reality is unless you are going to actually go through the effort of deploying 3.0 to all you 2008 R2/7 computers and earlier, you're only going to be able to use it for a limited selection of tasks.
    Working B.S., Computer Science
    Complete: 55/120 credits SPAN 201, LIT 100, ETHS 200, AP Lang, MATH 120, WRIT 231, ICS 140, MATH 215, ECON 202, ECON 201, ICS 141, MATH 210, LING 111, ICS 240
    In progress: CLEP US GOV,
    Next up: MATH 211, ECON 352, ICS 340
  • the_hutchthe_hutch Banned Posts: 827
    Ever since I've been spoiled working with 3.0...I could never go back to 2.0. The few times I've had to, I've gotten so frustrated.
Sign In or Register to comment.