Hey Guys -
I've recently started to use PowerShell with SCCM 2012 (and wish I had earlier.) I can launch PowerShell from the SCCm console and easily be ready to run scripts / cmdlets. However, when trying to connect to the site drive when launching from a command prompt, powershell not launched by console, or on a remote system; I can't get to it.
I need to be able to do this as I need to do is run a few scripts as scheduled tasks on the primary soon.
Below is the procedure I follow to try to connect. Please let me know what I'm leaving out:
1. Launch PowerShell x86 from machine with SCCM Console installed
2. Set execution policy to unrestricted
3. Run "Import-Module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1' " to import the cmdlets
From this point, should I not be able to type "cd A00:" (A00 is our primary site code) to change to the site drive? I can when launched from the console. When I do, I get the following:
What am I missing? By the way, I'm using Windows 7 x64 Pro and PowerShell 3.0 - however - I seem to get the same result when even trying the same procedure on the primary, itself. Thanks!
Ben K.
UPDATE
I just tried a few things, but haven't gotten it working yet (though closer) Here's what I'm doing:
1. Created a PS1 script named test.ps1 which has following code in it (ConfigMGR installed to D:\)
cd 'D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin' Import-Module 'D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1' cd A00: Set-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "Workstation Related - Mar 2014 Deployment" -CollectionName "Workstation Patch Management - Window #1 - 2nd Sunday - Auto Restart" -DeploymentName "Workstation Patch Management - Window #1 - 2nd Sunday - Auto Restart" -DeploymentType Available -VerbosityLevel OnlySuccessAndErrorMessages -TimeBasedOn UTC -DeploymentAvailableDay 2014/3/9 -DeploymentAvailableTime 5:00 -DeploymentExpireDay 2014/3/9 -DeploymentExpireTime 5:00 -UserNotification DisplaySoftwareCenterOnly -SoftwareInstallation $False -AllowRestart $False -RestartServer $False -RestartWorkstation $False -ProtectedType NoInstall -UnprotectedType NoInstall Start-Sleep -s 10 Set-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "Workstation Related - Mar 2014 Deployment" -CollectionName "Workstation Patch Management - Window #1 - 2nd Sunday - Manual Restart" -DeploymentName
2. From command line, run:
%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -executionpolicy unrestricted 'd:\test.ps1'
When I run it, it returns to a command prompt after a few seconds as though it worked, but no changes have been made. I tried editing the ps1 file to include just the first 3 lines to see if I'd end up at an a00: prompt, but didn't. I received the below error:
I verified that quotations are where they need to be so don't know what's up. Any ideas? Thanks!