Topic: get-disk cmdlet non-functional  (Read 1042 times)

0 Members and 1 Guest are viewing this topic.

get-disk cmdlet non-functional
« on: October 12, 2017, 03:17:46 PM »

Venerence

  • Jr. Chef
  • **
  • Date Registered: Jan 2014
  • Posts: 49
I've been writing some personal powershell GUI programs for imaging purposes (basically my own customized WINNTSetup), and I can't seem to run get-disk. I get an error you see attached. Normally I'd try to work around it, but get-disk is pretty fundamental to my script. Any idea why powershell isn't supporting it?


Re: get-disk cmdlet non-functional
« Reply #1 on: October 12, 2017, 06:54:21 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 178
I get an "Invalid Class" error for get-disk in powershell.  Are you running the powershell plugin off of the server or have you made your own/changed the provided plugint?
« Last Edit: October 18, 2017, 07:27:32 PM by bob.omb »

Re: get-disk cmdlet non-functional
« Reply #2 on: October 12, 2017, 11:34:59 PM »

Venerence

  • Jr. Chef
  • **
  • Date Registered: Jan 2014
  • Posts: 49
Standard powershell script, along with the .net 3.5 enabled and 2.0/3.5/4.0/4.5 added via pe script. Also tried 4.0/4.5 only (still with netfx enabled) just to see if it made a difference, it didn't.

Re: get-disk cmdlet non-functional
« Reply #3 on: October 13, 2017, 03:01:15 AM »

JFX

  • Moderator, Code Baker
  • Sr. Chef
  • *****
  • Date Registered: Dec 2010
  • Posts: 912
I remember that problem.

copy the following files into system32

mispace.dll
storagewmi.dll
wmitomi.dll

copy overwrite the system32\wbem folder with the one from install.wim.

rebuild WIM and try again.

Re: get-disk cmdlet non-functional
« Reply #4 on: October 14, 2017, 01:32:28 AM »

Venerence

  • Jr. Chef
  • **
  • Date Registered: Jan 2014
  • Posts: 49
I remember that problem.

copy the following files into system32

mispace.dll
storagewmi.dll
wmitomi.dll

copy overwrite the system32\wbem folder with the one from install.wim.

rebuild WIM and try again.
:thumbsup:

Re: get-disk cmdlet non-functional
« Reply #5 on: October 15, 2017, 04:56:07 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 178
Is this caused by a plugin that runs after powershell that changes those files? (Need to move powershell fix to end of build process?) - Or is this just an overall fix on the plugin itself that needs to be done?
« Last Edit: October 18, 2017, 07:27:08 PM by bob.omb »

Re: get-disk cmdlet non-functional
« Reply #6 on: October 17, 2017, 03:24:28 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 178
Plugin has been updated on the server by Lancelot.  Update tested and working perfectly. Thanks JFX and Lancelot!  :thumbsup:

Re: get-disk cmdlet non-functional
« Reply #7 on: November 21, 2017, 07:33:28 AM »

Tsjippy

  • Jr. Chef
  • **
  • Date Registered: Jun 2017
  • Posts: 12
Somehow related is this issue:

When I run this command in powershell "(Get-WmiObject -Class Win32_TPM -EnableAllPrivileges -Namespace "root\CIMV2\Security\MicrosoftTpm").IsActivated_InitialValue"
I get the error: "Get-WmiObject : Provider load failure"

Re: get-disk cmdlet non-functional
« Reply #8 on: November 21, 2017, 07:51:18 AM »

Tsjippy

  • Jr. Chef
  • **
  • Date Registered: Jun 2017
  • Posts: 12
Fixed it by copying  and not replacing system32
copy overwrite the system32\wbem

Re: get-disk cmdlet non-functional
« Reply #9 on: November 21, 2017, 05:02:31 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7517
Hi Tsjippy,

Do you have updated plugin from server..... ?


Overall, It will be better If you are sure you have the latest project from server with

Utils\Update ... (Exact and Secure) plugin ---> Update button

:turtle:

Re: get-disk cmdlet non-functional
« Reply #10 on: November 28, 2017, 07:15:55 AM »

Tsjippy

  • Jr. Chef
  • **
  • Date Registered: Jun 2017
  • Posts: 12
I have the latest version.

I found the missing file, its TpmCoreProvisioning.dll found in "C:\Windows\System32\TpmCoreProvisioning.dll"

If I build a new project based on 1709, with .net and powershell, and include this file to it, all works fine

Re: get-disk cmdlet non-functional
« Reply #11 on: November 29, 2017, 02:33:00 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7517
Hi Tsjippy

can you provide a test ps file so we can confirm with.
Code: [Select]
powershell -ExecutionPolicy ByPass -File Tsjippy.ps1

:turtle:

Re: get-disk cmdlet non-functional
« Reply #12 on: November 30, 2017, 02:47:35 AM »

Tsjippy

  • Jr. Chef
  • **
  • Date Registered: Jun 2017
  • Posts: 12
Sure, like I said you can confirm it with this command (Get-WmiObject -Class Win32_TPM -EnableAllPrivileges -Namespace "root\CIMV2\Security\MicrosoftTpm").IsActivated_InitialValue

See also this file: https://1drv.ms/u/s!AmTy_UOLELH8hpU4udJYFFukToEjxQ

Re: get-disk cmdlet non-functional
« Reply #13 on: November 30, 2017, 12:12:25 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7517
Thanks Tsjippy

New PowerShell plugin on server (current v18)

Get-WmiObject -Class Win32_TPM ... works fine now.  :great:

Also
With Enabled MMC plugin
Get-Disk
Get-Volume

works out of box.  :great:




**
I also create a "PowerShell Development Plugin" plugin to test things related to Power Shell things easier.

PowerShell Development Plugin v3 on server.

Downloads\AppYGS\System Tools\PowerShell Development Plugin

ps:
http://TheOven.org/index.php?topic=1208.0
1a) Update \Downloads\ - Update Download list

:turtle:

Re: get-disk cmdlet non-functional
« Reply #14 on: December 04, 2017, 03:34:05 AM »

Tsjippy

  • Jr. Chef
  • **
  • Date Registered: Jun 2017
  • Posts: 12
Thanks!

It is still missing one dll, namely tbs.dll (in the system 32).
Without that it does not give an error, but also no output...

Can you include that file as well?

Re: get-disk cmdlet non-functional
« Reply #15 on: December 04, 2017, 04:48:51 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7517
Hi Tsjippy,

Added tbs.dll to PowerShell plugin.  :thumbsup:

*
Can you provide more info :
what does not give an error, but also no output... ?
->
how to reproduce case without tbs.dll using a ps1 ?

:turtle:

Re: get-disk cmdlet non-functional
« Reply #16 on: December 05, 2017, 03:15:29 AM »

Tsjippy

  • Jr. Chef
  • **
  • Date Registered: Jun 2017
  • Posts: 12
You are a hero, I can confirm it is now working. (Get-WmiObject -Class Win32_TPM -EnableAllPrivileges -Namespace "root\CIMV2\Security\MicrosoftTpm").IsActivated_InitialValue is now returning True or False instead of null

Re: get-disk cmdlet non-functional
« Reply #17 on: December 06, 2017, 12:51:33 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7517
Thanks Tsjippy,

You are The Hero, thanks for spending the time to give feedback.  :great:

:turtle:

 

Powered by EzPortal