OnedriveMapper.ps1 4.04 script is showing network drive - powershell

I am using famous Onedrivemapper version 4.04 powershell script from https://gitlab.com/Lieben/OnedriveMapper_V3/-/blob/master/OneDriveMapper.ps1
This is basically used for adding Sharepoints as network drive. when I mention my sharepoint link in the script and run, it shows that the drive is mapped but the drive is not showing in my machine.

The issue is the "...DavWWWRoot\\teamsite..." double backslash, therefor the net use command throws an error.
Add this to line 608 of his 4.04 script and it should work:
$driveMapping.webDavPath = $driveMapping.webDavPath.Replace('DavWWWRoot\\', 'DavWWWRoot\')
Your code should look like this:
.........
function MapDrive{
Param(
$driveMapping
)
$driveMapping.webDavPath = $driveMapping.webDavPath.Replace('DavWWWRoot\\', 'DavWWWRoot\')
if($driveMapping.targetLocationType -eq "driveletter"){
.........
I know it's dirty, but I didn't want to go through 3000 lines of code to solve this

Related

Relative Path (pathlib) name working on MAC OS but on Windows gives me a error

Currently I am working a project that has have been using the pathlib library so I can work on my Windows desktop when I need too and on my MacBook Pro. Essentially be able to work between both operating systems. I have not have any issues at all until right now. Here is the set up:
I have a pipeline set up to automatically save a .joblib and a whole lot of .png files that will go to a directory called
output_dir = Path('../Trained_Models/Differential_gene_analysis/A Kidney Cancer Transcriptome Molecular Signature Identifies Tumors with Tumor Thrombus/Models train on TCGA data and test on Rodriguez data/Oct-XX-20XX')
For example, if I want to save a .joblib file under the name RandomForest_TumorThrombus_104.joblib,I would use the command
joblib.dump(model ,output_dir / 'RandomForest_TumorThrombus_104.joblib')
On my MacBook Pro, I have no issues when this is ran, but on Windows it gives me the following error
FileNotFoundError: [Errno 2] No such file or directory: '..\\Trained_Models\\Differential_gene_analysis\\A Kidney Cancer Transcriptome Molecular Signature Identifies Tumors with Tumor Thrombus\\Models train on TCGA data and test on Rodriguez data\\Oct-17-2022\\RandomForest_TumorThrombus_104.joblib'
I have tried to use the .resolve() method to get the absolute path but still gives me the same error. I have tried to experiment to try to see what is goin on such as using os.path.exists(). When using the os.path.exists() method I get True for the follwoing command:
os.path.exists(output_dir)
So it does indeed recognize that the directory exists. The next thing I tried was to rename the file to something like dddddd.joblib and that worked. But I find that only a few names for the file would allow me to save the files. During debug I found that the most recent Traceback occurs here:
with open(filename, 'wb') as f:```
I was wondering if anyone here had any idea what was going on here and how I can fix this issue? Please and Thank you.
The solution was to enable long paths on Windows.

Running a vboxmanage clonemedium from a PowerShell script

This is probably nothing but I'm not able to make a simple VirtualBox vboxmanage clonemedium command run correctly in a PS script.
Seams like there's a quote issue. Tried a lot, got no results.
My paths to the source and destination files are previously stored into 2 variables.
If I trace them, they are perfectly OK.
$sourceFile = "C:\VirtualBox VMs\OdooV8-Clone1\Odoo-imchem-64b-Clone1.vdi\"
$destinationFile = "E:\TestVMbackup\$thedate\OdooV8-imchem-clone_$theShortDate.vdi"
vboxmanage clonemedium disk '$sourceFile' '$DestinationFile' --variant Fixed
This last try returns:
VBoxManage.exe: error: Could not find file for the medium 'C:\Program Files\Oracle\VirtualBox\$sourceFile' (VERR_FILE_NOT_FOUND)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium, callee IUnknown
Using:
vboxmanage clonemedium disk "$sourceFile" "$DestinationFile" --variant Fixed
was worst.

Powershell hang when execute commands

I am testing to create SCCM 2012 application deployment types via powershell and below is my command that is working. Im succesfully able to create the deployment types using below line of code
Add-CMDeploymentType -ApplicationName "PowerTest" -InstallationFileLocation "\\sccmserver\folder$\Powershell_Test\Sources\googlechromestandaloneenterprise.msi" -MsiInstaller -AutoIdentifyFromInstallationFile -ForceForUnknownPublisher $true -InstallationBehaviorType InstallForSystem -Language "English" -DeploymentTypeName 'Setup' -InstallationProgram "'code1.wsf' /SMSLaunch /foldername:Chrome 2.0.4'"
But the problem is when I add below parameters (-MaximumAllowedRunTimeMinutes 20 -EstimatedInstallationTimeMinutes 10 -LogonRequirementType WhetherOrNotUserLoggedOn). When I click enter, it seems unable to execute. It does not display any error but it just do not execute. I check in help, and below parameters do exist. Or is it because these parameters depends on other set of parameters that you have to specify first in order for it to able to run?
-MaximumAllowedRunTimeMinutes 20 -EstimatedInstallationTimeMinutes 10 -LogonRequirementType WhetherOrNotUserLoggedOn
Got it. Parameters -MaximumAllowedRunTimeMinutes is actually part of Set-CMDeploymentType cmdlet and not Add-CMDeploymentType.

Cudafy chapter 3 example has path issue how to fix?

Using Cudafy version 1.29, which can be downloaded from here
I am executing the examples that are found in the install folder CudafyV1.29\CudafyByExample\
Specifically, "chapter 3" example that begins line 42 of program.cs calls the following:
simple_kernel.Execute();
which is this:
public static void Execute()
{
CudafyModule km = CudafyTranslator.Cudafy(); // <--exception thrown!
GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId);
gpu.LoadModule(km);
gpu.Launch().thekernel(); // or gpu.Launch(1, 1, "kernel");
Console.WriteLine("Hello, World!");
}
The indicated line throws this exception:
Compilation error: CUDAFYSOURCETEMP.cu
'C:\Program' is not recognized as an internal or external command,
operable program or batch file. .
Which is immediately obvious that the path has spaces and the programmer did not double quote or use ~ to make it operational.
So, I did not write this code. And I cannot step through the sealed code contained within CudafyModule km = CudafyTranslator.Cudafy();In fact I don't even know the full path that is causing the exception, it is cut-off in the exception message.
Does anyone have a suggestion for how to fix this issue?
Update #1: I discovered where CUDAFYSOURCETEMP.cu lives on my computer, here it is:
C:\Users\humphrt\Desktop\Active Projects\Visual Studio
Projects\CudafyV1.29\CudafyByExample\bin\Debug
...I'm still trying to determine what the program is looking for along the path to 'C:\Program~'.
I was able to apply a workaround to bypass this issue. The workaround is to reinstall all components of cudafy in to folders with paths with no ' ' (spaces). My setup looks like the below screenshot. Notice that I also installed the CUDA TOOLKIT from NVIDIA in the same folder - also with no spaces in folder names.
I created a folder named "C:\CUDA" and installed all components within it, here is the folder structure:

Need Helping Editing Perl Script for PowerChute Network Shutdown

I found the perl script on the vmware community. The problem is that within APC's PCNS it will not let you specify parameters to run with the script.
The script requires calling on a host-list file Usage: ./shutdownHostViaSOAPAPICall.pl [HOST_FILE]
So I would like to add the hosts I want to shutdown directly into the script instead of having to call a hostlist file.
Can anyone help with this? Here is the Vsphere thread for reference. And so that you can download the script.
https://communities.vmware.com/docs/DOC-11623
Thanks
Replace
my $host_username = 'fillmein';
my $host_password = 'fillmein';
#### DO NOT EDIT PAST HERE ####
my #hostlist;
my ($file,$request,$message,$response,$retval,$cookie);
&verifyUserInput();
&processFile($file);
With
my $host_username = 'yourusername';
my $host_password = 'yourpass';
#### DO NOT EDIT PAST HERE ####
my #hostlist = ("host1.somedomain", ""hostx.somedomain"");
my ($file,$request,$message,$response,$retval,$cookie);
#&verifyUserInput();
#&processFile($file);
I only have 1 host at each site to shut down so this is a clean solution for me.