0
votes

I know the command for 64bit in PowerShell but the same when I was trying remotely for another computer having 32bit that PowerShell command is not working which are given below. Can anyone post the command for 32bit in PowerShell which run perfectly in remote computer having 32bit PowerShell running?

Disk Defragmentation: Optimize-Volume -DriveLetter C -Defrag -Verbose
Virus Scan: Start-MpScan -ScanType QuickScan -ScanPath C

When I run disk defragmentation code written above then error appears like

This command is not supported on x86 running in x64 environment

and when I run virus scan error then same error is occurring. So maybe they are asking for 32 bit command. I tried a lot to perform the below command.

$v = gwmi Win32_Volume
# Display Number of volumes
"Number of volumes {0}: " -f $v.Length

# Now get the C:\ volume
$v1 = $v | where {$_.Name -eq "C:\"}

# Perform a defrag analysis
$v1.defraganalysis().defraganalysis

# Defrag the volume
$v1.defrag($true)

# Redo the Defrag analysis
$v1.defraganalysis().defraganalysis

but the same code when I had written in the Python script it didn't work. It shows the

The null value return

1
Please edit the question and add more details. What does "command is not working" mean exactly? Nothing happens? An error message appears? What is the exact command you use for remote launching? Please don't answer as a comment, those are hard to read. - vonPryz
Please show how you're running the command remotely and the exact error message you're getting from that command. - Ansgar Wiechers

1 Answers

0
votes

Most likely the 64bit PowerShell is the default PowerShell opening and you need to manually open the 32bit version by searching for Windows PowerShell (x86).

The default location for Windows PowerShell (x86) is: %SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

Try the same commands in here.