When creating a Hyper-V VM at the "Specify Name" stage make sure you check the box to "Store the virtual machine in a different location". Why? Well let's assume you are at this step, you have the box checked and you have entered the following for the "Name" and "Location" fields:
Name: "My VM Name 001"
Location: "C:\ClusterStorage\volume1\hyper-v\"
In the example above Hyper-V will create a single folder named "My VM Name 001" at location "C:\ClusterStorage\volume1\hyper-v\" and all components of that VM will be contained under that folder (as opposed to having some components at the root of "C:\ClusterStorage\volume1\hyper-v\" and some under a subdirectory named "My VM Name 001" which is the default behavior). This will make your VM's more self-contained and (therefore) easier to administer.
Friday, September 30, 2016
Tuesday, September 6, 2016
Using SysNative to redirect a SCCM Package to use 64-Bit stuff...
Everywhere you go it seems like all the "experts" say to use the Package model (not the Application model) when you want to deploy a script using SCCM. The problem is Packages seem to only be be cable of executing in 32 bit mode (even on 64_bit OSes) because the SCCM client is 32-Bit. Obviously this presents a problem if you ever need to have your script reference anything 64-bit. I did some googling and found a number of solutions out there but (ultimately) found them a bit clunky. So I grabbed the best bits I could found out of all of them and combined them into my own script:
To use it just uncomment your script language of choice (while commenting out the ones you don't want), save it as a .CMD file in the same folder with the same name as the script you want to execute and specify the .CMD file as your Command Line. It should handle the rest for you.
@ECHO OFF & CLS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: SysNative Redirect
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Purpose: SysNative is a virtual folder visible to 32-Bit applications but not
:: visible to 64-Bit applications. This script uses SysNative to redirect scripts
:: to use native executables on when run on a 64-Bit Operating System.
:: Version: 2.1
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
REM Set script filename:
SET "_MyScript=%~n0.ps1"
REM OS Run architecture check and redirect if needed:
If "%PROCESSOR_ARCHITEW6432%"=="" (GOTO :_STANDARD) ELSE (GOTO :_SYSNATIVE)
:_SYSNATIVE
%WINDIR%\sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy bypass -file "%~dp0%_MyScript%"
REM %WINDIR%\sysnative\cscript.exe "%~dp0myscript.vbs"
REM %WINDIR%\sysnative\cmd.exe "%~dp0myscript.cmd"
GOTO :_END
:_STANDARD
powershell.exe -NoProfile -ExecutionPolicy bypass -File "%~dp0%_MyScript%"
REM cscript.exe "%~dp0myscript.vbs"
REM cmd.exe "%~dp0myscript.cmd"
GOTO :_END
:_END
REM Pause to view results:
REM ECHO.
REM ECHO Press any key to exit ...
REM PAUSE > NUL
To use it just uncomment your script language of choice (while commenting out the ones you don't want), save it as a .CMD file in the same folder with the same name as the script you want to execute and specify the .CMD file as your Command Line. It should handle the rest for you.
Subscribe to:
Posts (Atom)