Powershell 2.0 cmdlet question
paulgswanson
Member Posts: 311
in Off-Topic
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.
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)
WGU Progress: B.S. Network Management & Design <- I quit (got bored)
Comments
-
Qord Member Posts: 632 ■■■■□□□□□□What is the device? If you can get to it with wmi, then PS can probably disable it.
-
paulgswanson Member Posts: 311When 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) -
Qord 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. 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'. -
paulgswanson Member Posts: 311Qord 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) -
ptilsen 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. -
the_hutch Banned Posts: 827Ever 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.