Powershell script deployment options in CM2012

Hello all,
I really don't know anything about PowerShell, but I found this interesting script to help with client issues. It references an input file that I can modify. My silly question is, what is the best way to use this script in CM2012? Try to create a package
and use this, create a task sequence or query? I am unsure how to use this. Any help/guidance/links would be greatly appreciated! Thanks! 
#ERROR REPORTING ALL
Set-StrictMode -Version latest
#STATIC VARIABLES
$SCRIPT_PARENT = Split-Path -Parent $MyInvocation.MyCommand.Definition
#FUNCTION RepairSCCM
Function Repair_SCCM
Write-Host "[INFO] Get the list of computers from the input file and store it in an array."
$arrComputer = Get-Content ($SCRIPT_PARENT + "\input.txt")
Foreach ($strComputer In $arrComputer)
#Put an asterisk (*) in front of the lines that need to be skipped in the input file.
If ($strComputer.substring(0,1) -ne "*")
Write-Host "[INFO] Starting trigger script for $strComputer."
Try
$getProcess = Get-Process -Name ccmrepair* -ComputerName $strComputer
If ($getProcess)
Write-Host "[WARNING] SCCM Repair is already running. Script will end."
Exit 1
Else
Write-Host "[INFO] Connect to the WMI Namespace on $strComputer."
$SMSCli = [wmiclass] "\\$strComputer\root\ccm:sms_client"
Write-Host "[INFO] Trigger the SCCM Repair on $strComputer."
# The actual repair is put in a variable, to trap unwanted output.
$repair = $SMSCli.RepairClient()
Write-Host "[INFO] Successfully connected to the WMI Namespace and triggered the SCCM Repair on $strComputer."
########## START - PROCESS / PROGRESS CHECK AND RUN
# Comment the lines below if it is unwanted to wait for each repair to finish and trigger multiple repairs quickly.
Write-Host "[INFO] Wait (a maximum of 7 minutes) for the repair to actually finish."
For ($i = 0; $i -le 470; $i++)
$checkProcess = Get-Process -Name ccmrepair* -ComputerName $strComputer
Start-Sleep 1
Write-Progress -Activity "Repairing client $strComputer ..." -Status "Repair running for $i seconds ..."
If ($checkProcess -eq $Null)
Write-Host "[INFO] SCCM Client repair ran for $i seconds."
Write-Host "[INFO] SCCM Client repair process ran successfully on $strComputer."
Write-Host "[INFO] Check \\$strComputer\c$\Windows\SysWOW64\CCM\Logs\repair-msi%.log to make sure it was successful."
ElseIf ($i -eq 470)
Write-Host "[ERROR] Repair ran for more than 7 minutes. Script will end and process will be stopped."
Invoke-Command -Computer $strComputer { Get-Process -Name ccmrepair* | Stop-Process -Force }
Exit 1
########## END - PROCESS / PROGRESS CHECK AND RUN
Catch
Write-Host "[WARNING] Either the WMI Namespace connect or the SCCM Repair trigger returned an error."
Write-Host "[WARNING] This is most likely caused, because there is already a repair trigger running."
Write-Host "[WARNING] Wait a couple of minutes and try again."
# If the script keeps throwing errors, the WMI Namespace on $strComputer might be corrupt.
# RUN SCRIPT
Repair_SCCM
#Finished
DM

Hi,
ConfigMgr questions should be asked in a ConfigMgr forum:
https://social.technet.microsoft.com/Forums/en-US/home?forum=configmanagersdk
At a quick glance though, you shouldn't be deploying this anywhere. Just run it.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing)

Similar Messages

  • Trying to deploy a batch or powershell script unsuccessful

    I've deployed a .cmd file out that contains a WMI script to uninstall all instances of an application called "VirtViewer". The script looks like this:
    taskkill /F /IM remote-viewer.exe /T
    wmic product where "name like 'VirtViewer%%'" call uninstall /nointeractive
    exit /B %EXIT_CODE%
    Previously, I had used MSI product codes for the uninstall, and got the same result. My original problem, is that there are currently 9 different versions of this app out there, so i am ripping them all out and replacing with 1 version. Installing over an
    old version does not overwrite the older one, it instead installs a new instance.
    Reading through the execmgr.log on the client, everything looks as it should.
    The end result, is that nothing happens. I had originally set the program to run as hidden, but then changed it to normal but still do not see it run. The application is right where i left it, untouched. If i run the script locally it works fine, but not
    when deployed. Am i missing something??
    <![LOG[Service startup.]LOG]!><time="16:09:31.647+300" date="01-12-2015" component="execmgr" context="" type="1" thread="248" file="execmgr.cpp:135">
    <![LOG[A user has logged on.]LOG]!><time="16:09:43.507+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4256" file="execreqmgr.cpp:4911">
    <![LOG[Requesting content from CAS for package VNT00018 version 21]LOG]!><time="16:11:13.649+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="contentaccesshelper.cpp:246">
    <![LOG[Policy arrived for parent package VNT00018 program Uninstall Script]LOG]!><time="16:11:13.649+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="execreqmgr.cpp:6893">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 6l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="event.cpp:405">
    <![LOG[Successfully created a content request handle {B2BA42EE-5988-47F4-BF44-ADAAC975994B} for the package VNT00018 version 21]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="contentaccesshelper.cpp:331">
    <![LOG[Program Uninstall Script change to state STATE_ADVANCED_DOWNLOAD content available]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="2" thread="124" file="executionrequest.cpp:3663">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from NotExist to AdvancedDownload]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="executionrequest.cpp:501">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="124" file="event.cpp:405">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramOfferReceivedEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    DateTime = "20150112211113.665000+000";
    MachineName = "VM-WIN7-MIKE";
    ProcessID = 1788;
    SiteCode = "VNT";
    ThreadID = 2528;
    ]LOG]!><time="16:11:13.665+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2528" file="event.cpp:715">
    <![LOG[Mandatory execution requested for program Uninstall Script and advertisement VNT20014]LOG]!><time="16:11:13.680+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:3527">
    <![LOG[Creating mandatory request for advert VNT20014, program Uninstall Script, package VNT00018]LOG]!><time="16:11:13.680+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:3653">
    <![LOG[An existing MTC token was not supplied, using ExecutionRequest's Id as MTC token and this execution request is the owner of resultant MTC task.]LOG]!><time="16:11:13.696+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:8942">
    <![LOG[Request a MTC task for execution request of package VNT00018, program Uninstall Script with request id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:13.696+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:8966">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from WaitingDependency to Ready]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:501">
    <![LOG[MTC task with id {D52026A7-5735-402B-868C-EF9791656512}, changed state from 0 to 4]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6288">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.712+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">
    <![LOG[MTC signaled SWD execution request with program id: Uninstall Script, package id: VNT00018 for execution.]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6406">
    <![LOG[Sending ack to MTC for task with id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:9005">
    <![LOG[Executing program VirtViewerUninstall.cmd in Admin context]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:3239">
    <![LOG[Execution Request for advert VNT20014 package VNT00018 program Uninstall Script state change from Ready to NotifyExecution]LOG]!><time="16:11:13.743+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionrequest.cpp:501">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.759+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[Checking content location C:\Windows\ccmcache\1c for use]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:1663">
    <![LOG[Successfully selected content location C:\Windows\ccmcache\1c]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:1719">
    <![LOG[Executing program as a script]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executionengine.cpp:82">
    <![LOG[Successfully prepared command line "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd"]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:650">
    <![LOG[Command line = "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd", Working Directory = C:\Windows\ccmcache\1c\]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:352">
    <![LOG[Running "C:\Windows\ccmcache\1c\VirtViewerUninstall.cmd" with 32bitLauncher]LOG]!><time="16:11:13.774+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:370">
    <![LOG[Created Process for the passed command line]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="scriptexecution.cpp:513">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramStartedEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    CommandLine = "\"C:\\Windows\\ccmcache\\1c\\VirtViewerUninstall.cmd\"";
    DateTime = "20150112211113.852000+000";
    MachineName = "VM-WIN7-MIKE";
    PackageName = "VNT00018";
    ProcessID = 1788;
    ProgramName = "Uninstall Script";
    SiteCode = "VNT";
    ThreadID = 2164;
    UserContext = "NT AUTHORITY\\SYSTEM";
    WorkingDirectory = "C:\\Windows\\ccmcache\\1c\\";
    ]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:715">
    <![LOG[Raised Program Started Event for Ad:VNT20014, Package:VNT00018, Program: Uninstall Script]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="executioncontext.cpp:459">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.852+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:13.868+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="event.cpp:405">
    <![LOG[MTC task with id {D52026A7-5735-402B-868C-EF9791656512}, changed state from 4 to 5]LOG]!><time="16:11:13.884+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2164" file="execreqmgr.cpp:6288">
    <![LOG[Program exit code 0]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="scriptexecution.cpp:676">
    <![LOG[Looking for MIF file to get program status]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executionstatus.cpp:282">
    <![LOG[Script for Package:VNT00018, Program: Uninstall Script succeeded with exit code 0]LOG]!><time="16:11:17.571+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executionstatus.cpp:262">
    <![LOG[Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramCompletedSuccessfullyEvent
    AdvertisementId = "VNT20014";
    ClientID = "GUID:E306FF26-C884-4E36-9C03-C19523A17F40";
    DateTime = "20150112211117.571000+000";
    MachineName = "VM-WIN7-MIKE";
    PackageName = "VNT00018";
    ProcessID = 1788;
    ProgramName = "Uninstall Script";
    SiteCode = "VNT";
    ThreadID = 4128;
    UserContext = "NT AUTHORITY\\SYSTEM";
    ]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="event.cpp:715">
    <![LOG[Raised Program Success Event for Ad:VNT20014, Package:VNT00018, Program: Uninstall Script]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="4128" file="executioncontext.cpp:483">
    <![LOG[Execution is complete for program Uninstall Script. The exit code is 0, the execution status is Success]LOG]!><time="16:11:17.587+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="execreqmgr.cpp:4165">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 10l, value Result:TRUE ,SDKCallerId:, user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:17.602+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">
    <![LOG[Requesting MTC to delete task with id: {D52026A7-5735-402B-868C-EF9791656512}]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:9036">
    <![LOG[MTC task with id: {D52026A7-5735-402B-868C-EF9791656512} deleted successfully.]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="executionrequest.cpp:9065">
    <![LOG[Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="VNT00018",ProgramID="Uninstall Script", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l]LOG]!><time="16:11:17.618+300" date="01-12-2015" component="execmgr" context="" type="1" thread="2564" file="event.cpp:405">

    I just tried using powershell to accomplish the same task, and got the same result. Script ran fine, but nothing resulted. 0 errors in the execmgr.log on the client.
    Program options:
    Command Line: Powershell.exe -executionpolicy Bypass -file .\VirtUninstall.ps1
    the powershell script looks like this:
    $app = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match "VirtViewer*"}
    $app.Uninstall()
    exit /B
    Again, the script runs great when launched locally, but not wehen deployed

  • Changing the Task Sequence Deployment Options via script

    Hi all,
    I am fairly new to SCCM 2012 scripting/SDK and couldn't find any helpful examples how to change the deployment options of task sequences by using a script.
    The problem is: we have got a significant number of TS that have the deployments set to "Download content locally when needed by running task sequence".
    I have to change this setting to "Download all content locally before starting task sequence".
    Afterwards I need to create a list of all changed TS Deployment options and also a list of current settings of all TS Deployment options.
    Therefore I would need a script that can read and set this particular option of the TS.
    Does anybody have a script that can do such tasks? Any help is highly appreciated.
    Btw, I am not picky, I can handle WMI, SQL, VBS, PowerShell, .Net Code (vb.net or c#). Whatever you have handy would be quite helpful.
    Many thanks
    Amir

    Hi,
    The Set-CMTaskSequence -DeploymentOption could help you change this setting.
    Set-CMTaskSequence
    Best Regards,
    Joyce Li
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • PowerShell Script to get the details Like Scope,Last Deployed date and Name for a Solution Deployed in the Farm.

    Hi Experts,
    I am trying to  build a PowerShell Script to get the details Like Scope,Last Deployed date and Name for a Solution Deployed in the Farm.
    Can anyone advise on this please.
    Regards

    Get-SPSolution|Select Name,Scope,LastOperationResult,LastOperationEndTime|Export-CSV "SPInstalledSolutions.csv" -NoTypeInformation
    SPSolution properties
    Get-SPSolution
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Deploy powershell script - Uninstall Forefront

    Hi
    Im trying to build a powershell script that uninstall Forefront Client and later install SCEP and it also copy the local exclusions from Forefront to insert in SCEP (registry).
    All works fine when Im running the script locally, but when Im deploying it from Altiris DS it halts on Microsoft Forefront Client Security Antimalware Service". Every time, I also have tried to sort them differently but it wont work.
    All I see in the event viewer is a warning:
    "Application 'C:\Program Files\Microsoft Forefront\Client Security\Client\Antimalware\MSASCui.exe' (pid 1964) cannot be restarted - Application SID does not match Conductor SID.."
    And then later an error:
    HRESULT:0x80070643
    Description:Cannot complete the System Center Endpoint Protection installation. An error has prevented the System Center Endpoint Protection setup wizard from completing successfully. Please restart your computer and try again. Error code:0x80070643. Fatal
    error during installation.
    This is the deployment from Altiris:
    powershell.exe -noexit "& 'C:\Temp\ForefrontSCEP.ps1'"
    Does anyone has any clue?
    Cheers!
    **** The script ****
    # Backup Forefront registry data
    Reg export "HKLM\SOFTWARE\Microsoft\Microsoft Forefront" C:\Temp\SCEPClient_New\exclbackup.reg
    # Create new registry item
    new-Item "HKLM:\SOFTWARE\Microsoft\" -Name "Microsoft Antimalware"
    new-Item "HKLM:\SOFTWARE\Microsoft\Microsoft Antimalware\" -Name Exclusions
    # Copy Forefront registry exclusion data to newly created regkey
    Copy-Item "HKLM:\SOFTWARE\Microsoft\Microsoft Forefront\Client Security\1.0\AM\Exclusions" -Destination "HKLM:\SOFTWARE\Microsoft\Microsoft Antimalware\" -Recurs
    # "Uninstall Forefront och MOM"
    # "Uninstall Microsoft MOM"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Operations Manager 2005 Agent"
    $app.Uninstall()
    # "Uninstall Forefront Assessment"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Forefront Client Security State Assessment Service"
    $app.Uninstall()
    # "Uninstall Forefront Antimalware"
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Forefront Client Security Antimalware Service"
    $app.Uninstall()
    # Install SCEP with policy
    Start-Process -FilePath C:\Temp\SCEPClient_New\scepinstall.exe -ArgumentList "/s /q /policy C:\Temp\SCEPClient_New\ServerSCEP.xml" -ErrorAction SilentlyContinue

    I finally solved, in two ways.
    For the powershell part:
    I changed the name match against a filter function. So now I can deploy the powershell script just fine.
    $app = Get-WmiObject -Class Win32_Product | Where-Object {
        $_.Name -match "Microsoft Operations Manager 2005 Agent"
    $application = Get-WMIObject Win32_Product -filter "Name='Microsoft Operations Manager 2005 Agent'"
    2nd solution:
    I also created a batch file which worked at my first try. Gotta love the old fashion way :)
    I post it here as well, maybe somebody can get use of it.
    Uninstall Forefront - Install SCEP - Copy local exclusions
    REM Backup Forefront exclusions
    regedit /e C:\Temp\ForefrontExclBackup.reg "HKLM\Software\Microsoft\Microsoft Forefront"
    REM Create SCEP registry keys
    reg add "HKLM\Software\Microsoft\Microsoft Antimalware"
    REM Create SCEP registry keys
    reg add "HKLM\Software\Microsoft\Microsoft Antimalware\Exclusions"
    REM Copy Foreront exclusions to SCEP
    reg copy "HKLM\Software\Microsoft\Microsoft Forefront\Client Security\1.0\AM\Exclusions" "HKLM\Software\Microsoft\Microsoft Antimalware\Exclusions" /s /f
    REM Uninstall Microsoft Forefront Client Security State Assessment Service
    MsiExec.exe /X{E8B56B39-A826-11DB-8C83-0011430C73A4} /qn
    REM Uninstall Microsoft Forefront Client Security Antimalware Service
    MsiExec.exe /X{436028CD-6476-4224-9274-8F0320F30FD1} /qn
    REM Uninstall Microsoft Operations Manager 2005 Agent
    MsiExec.exe /X{F692770D-0E27-4D3F-8386-F04C6F434040} /qn
    REM Install SCEP and policys
    C:\Temp\SCEPInstall.exe /policy C:\Temp\ServerSCEP.xml /s

  • Application deployment evaluation powershell script

    Hi,
    Is there a way that I can run a powershell script or vbs script that will allow me to run the Client actions on the local client. kind of like a shortcut that will go into the configuration manager client control panel icon and run the client action required.
    Specifically for the Application Deployment Evaluation
    Any help would be appreciated
    Regards
    Mike

    Hi,
    Check out this old thread on the topic,
    http://social.technet.microsoft.com/Forums/en-US/9ec7318f-4ab7-4db3-bfa5-958ab1c39f4f/application-deployment-evaluation-cycle-not-willing-to-start-by-script?forum=configmanagersdk
    An example is included in there as well.
    You can also use the Right-click tools extensions in the console which include this action as well.
    http://myitforum.com/myitforumwp/2012/09/21/sccm-rctools/
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • Powershell scripting multiple WSP deployment

    I'm moving an application with around 40 custom WSPs to a new environment, and need to find a way to script their deployment. Around half of them are Globally deployed.
    I can deploy them one at a time using
    add-spsolution –literalpath c:\...\SolutionName.wsp
    Check _admin/solutions.aspx to ensure it's in Solution Management
    Select wsp and Deploy Solution
    Go to application
    Site Actions > Site Settings > Site Collection Administration > Site Collection Features
    Activate new feature
    Can anyone point out documentation on how to do this in an automated fashion? 
    Thanks,
    Scott

    Hi Scott,
    Powershell script for deploying multiple solution
    http://deploymentpowershell.codeplex.com/
    http://gallery.technet.microsoft.com/projectserver/Deploy-multiple-wsp-file-1114692f
    and this thread as simplified version
    http://social.technet.microsoft.com/Forums/en-US/72771456-5e6e-4910-b586-a4450ac61c3d/how-to-deploy-multiple-wsp-solutions-in-the-farm-or-same-server?forum=sharepointadminprevious
    You can check this site to learn PowerShell
    http://technet.microsoft.com/en-us/sharepoint/jj672838.aspx
    http://sergeluca.wordpress.com/2011/09/07/my-sharepoint-2010-powershell-tutorial-for-sharepoint-200-developers/
    http://www.youtube.com/watch?v=UuLho-HecXA
    there are good books on PowerShell
    PowerShell for SharePoint 2013 how to
    Beginning PowerShell for SharePoint 2013
    see this blog for more information
    http://www.matthewjbailey.com/sharepoint-powershell-programming-learning/
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • Deploy Powershell Script As An Application Install Question

    I want to create an application (not packages) to run a powershell script to install a software. In this script it installs software and copies files over to different directories. Is there a way to do this in Applications? Currently I've been creating
    task sequences to accomplish this which does work but I was wondering if this could be done thru applications or maybe if there is some better idea of doing this. Any advice would be grateful. Thanks in advance.

    Hi,
    Any updates?
    If this problem has not been resolved, please check AppIntentEval.log and AppEnforce.log to see whether there are some helpful information.  
    " I can run it manually from the ccmcache folder and it'll install the software but when running the "install.ps1" file from SCCM it doesn't install the software but does copy files to the directory specified."
    Could this be related to the account running the script? How about running as system account?
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Error while adding the app in the sharepoint(2013) page through powershell script

    Hi,
        I have created one powershell script to uninstall and install the sharepoint 2013 apps. The code is working fine, but after adding the app in the page I am getting the error "
    Internet Explorer can not display the webpage".
    If I am deploying the app through Visual Studio, its getting deployed successfully and I am getting an option to trust the app.And I am able to add it in the page. But this permission is not coming when I am installing the app using power shell.
    Please let me know whether to do any modifications to the power shell script.
    Thanks.
    Pradeep

    Hi,
       We are using sharepoint hosted app.
    Below is the script to uninstall and install the app.
    cls
    Add-PSSnapin Microsoft.SharePoint.PowerShell –ea SilentlyContinue
    # uninstall the app
    Write-Host "uninstallation of app"
    $InstalledSPApps = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com"
    $appToUninstall = $InstalledSPApps | where {$_.Title -eq 'myCustomSharepointApp'}
    if ($appToUninstall -ne $null)
        Uninstall-SPAppInstance -Identity $appToUninstall ;
        Write-Host "uninstalled successfully"
    # Import-SPAppPackage
    Write-Host "Import the app"
    pause
    $sourceApp = ([microsoft.sharepoint.administration.spappsource]::RemoteObjectModel);
    $myspapp = Import-SPAppPackage -Path "D:\SharePoint 2013\AppsSolution\myCustomSharepointApp.app" -Site "http://mySharepointSite.xyz.com" -Source $sourceApp ;
    Write-Host "Enter to install the app"
    pause
    $app = Install-SPApp -Web "http://mySharepointSite.xyz.com" -Identity $myspapp;
    $AppName = $app.Title;
    Write-Host "app '$AppName' registered"
    pause
    $appInstance = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com" | where-object {$_.Title -eq $AppName};
    $counter = 1;
    $maximum = 150;
    $sleeptime = 2;
    Write-Host -ForegroundColor White "Please wait..." -NoNewline;
    pause
    while (($appInstance.Status -eq ([Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installing)) -and ($counter -lt $maximum))
        Write-Host "." -NoNewline;
        sleep $sleeptime;
        $counter++;
        $appInstance = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com" | where-object {$_.Title -eq $AppName}
    pause
    if ($appInstance.Status -eq [Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installed)
        Write-Host "The App was successfully installed.";
        $appUrl = $appInstance.AppWebFullUrl;
        Write-Host -ForegroundColor White "The App is available at '$appUrl'.";

  • Creating powershell scripts using SCCM 2012 device properties

    I am trying to create a PowerShell script that will create a MAB object based on SCCM device properties. This MAB object is needed to reimage over our network.
    My goal is to create a task sequence that will utilize these properties and create the MAB object in our AD. This will be the first step in my Task Sequence. This will have to use the SCCM device MAC Addresses property information to populate a
    sAMAccount property in my AD object.
    Any suggestions on how to start this process?

    I am still working on actually getting the full process completed here. I have a script that completes the necessary task of creating an MAB object in our Active Directory. This works from a command line opened on the client machine. When I deploy the script
    in a Task Sequence it does not complete. Here is what I am deploying in my task sequence.
    %winDir%\System32\windowsPowershell\v1.0\powershell.exe -noprofile -command Set-ExecutionPolicy Bypass LocalMachine -force
    %winDir%\System32\windowsPowershell\v1.0\powershell.exe -noexit -command import-module ActiveDirectory -force;MABCreation.ps1 -force;Set-ExecutionPolicy RemoteSigned LocalMachine -force
    This errors at the import step everytime. I have created a batch file and used the command line option in the task sequence. I have also tried to Disable 64 bit file redirection option on and off. Any further suggestions?

  • Using Echo Command in PowerShell Script for Configuration Item

    Hello All,
    Before you tell me to post my PowerShell question to the PowerShell Forum, please know that the PowerShell portion of my task works just fine. It is the SCCM portion of my task that keeps failing, so that is why I am here. To give some background...
    There are two servers in our SCCM test environment. Both the SCCM server and SQL DB server are 2012, patched and updated.
    Test servers in my Device Collection being used for running Baselines and Reports against are 2008R2 and 2012, patched and updated.
    I have created a Configuration Item that checks to see if the FTP Server Role Feature has been installed on a 2008 or 2012 server. To do the check, I am using the following PowerShell script:
    (get-windowsfeature -Name Web-Ftp-Server).Installed
    When I log into my 2008R2 and 2012 test servers, and run this command directly on the server, it will return a "True" if the FTP Server Role Feature is installed on either server, and a "False" if it is not installed. Basically,
    it works as advertised.
    When I setup my Configuration Item and then deploy my Baseline, or run a report against my device collection of test servers, SCCM will return a correct response (True or False) for the 2012 test server, but throws the following error for the 2008R2
    server:
    0x87df00329 application requirement evaluation or detection failed
    Google searches for this have not been very helpful.
    Now, when I created the Configuration Item and referenced PowerShell, the configuration screen has the following note:
    "Specify the script to find and return the value to be assessed for compliance on client devices. Use the echo command to return the script value to Configuration Manager."
    Since I did not include an echo command in my PowerShell script above, I figured that was my problem, so I did the following:
    Logging onto both of my test servers (2008R2 & 2012) I was able to successfully run the following PowerShell commands and get the expected responses of True or False:
    (get-windowsfeature -Name Web-Ftp-Server).Installed | echo
    (get-windowsfeature -Name Web-Ftp-Server).Installed | write-output (http://technet.microsoft.com/en-us/library/hh849921.aspx)
    (get-windowsfeature -Name Web-Ftp-Server).Installed | write-host (http://technet.microsoft.com/en-us/library/ee177031.aspx)
    However, when I use any of these PowerShell commands in my Configuration Item, NEITHER of my test servers returns a response to the SCCM server.
    When I check the report, both servers show as "Unknown" and when I click on the number 2 (as in 2 servers unknown), the following report page (List of unknown assets for a configuration baseline) has absolutely no data/information at all.
    So...I am at a loss.
    SCCM tells me to use an echo command to return a script value to Configuration Manager. The PowerShell scripts above, with the various echo related commands, work just fine on the servers themselves, but they return no information when run via SCCM.
    What am I missing?
    Any help will be appreciated.
    Thanks in advance for your time.

    Sorry for my ignorance, but I don't understand. (I forgot to mention that I am new at both PowerShell and SCCM.)
    After I change the PowerShell script to add the echo/write-output/write-host cmdlet, I open the ConFig Item and "Clear" the PowerShell script and then re-add it. When I do that, it correctly shows the change in the ConFig Item.
    Next I open the Baseline, then open the ConFig Item within the Baseline to make sure the change is reflected there as well, which it is.
    I then deploy the Baseline to my Device Collection. After that, I run a report against the Baseline and Device Collection and it returns the "Unknown" result.
    If I open the PowerShell script and remove the echo/write-output/write-host cmdlet, then go through the rest of the process of updating and reporting, the result it returns changes, showing one server in compliance and the other server out of compliance,
    which leads me to think that all changes have taken correctly.
    Does that sound right? If I manually deploy the Baseline, is that the same as the client retrieving policies from the management point?
    Sorry to be so thick but I'm learning as I go.
    Thanks again for your help.

  • Disable Static IP in Windows 8.1 and Windows 7 or Powershell Script to get network "connected to" value

    Hi,
    I´m in a situation where I need to disable static IP option on all Domain machines (workstations). I have found many different forum topics about that but nothing is suitable for me. Let me describe a situation:
    * In our environment every computer have specific IP configured in DHCP (specific MAC = specific IP). Machines Must be configured DHCP enabled!
    * In our environment all developers are local admins in their computers. This can´t be changed as we are IT corporation and this is our policy.
    * As every IP have specific rights in Firewall to access different places then some IT guys are quite smart to change their IP to static IP that have more access then they should have.
    This last thing is my main problem! We have working PKI and NPS in both WLAN and LAN so only domain and certified computers can have access to our local network. My mission is to prevent local admins to change IP addressess by themselves but I can´t find
    a good solution for doing that. I have tought about Powershell script that is published by SCCM or GPO to all workstations and script idea is to find network card that is "connected to" our "domain.com" network. If this is true then automatically
    DHCP will be enabled for that interface (Set-NetIPInterface -Dhcp Enabled). I know that here is an open window for some moment when script will be ran again or GPO policy will be refreshed but it´s better then nothing. In this script I have one problem - I
    can´t find a solution about how to find network interface that is connected to our "domain.com"? It seems that there is no easy way to do that. 
    Is there any other and better solution to accomplished this situation. Any good ideas will be appreciated.
    Best Regards,
    Taavi

    Hi,
    the real answer is the one you don't want to hear: don't make your users local admninistrators.
    Local administrators will always be able to get araound any security measurement you put in place. For gpo's for example, they can identify the involved registry key, configure it to their desired value and
    remove privileges for everyone but themselves to write the key. Upcoming 'gpupdate' will not be able to write the values...
    For your script, I would recommend to just configure all adapters to dhcp on the client computers. After all the location detection depends on the network Location Awareness service. If your users disable that one (an rermove the appropriate privileges from
    registry ;) ) your script would again be useless.
    That being said, as you post to the security forums my answer is focussed on the security off your solution. if you need assistance in creating this script, I would advice to post back in the Scripting guys forums (and leave out the why as you will otherwise
    agin be pointed on the flawed security ;) )
    I think get-connectionprofile might already be helpull on 8.1
    MCP/MCSA/MCTS/MCITP

  • How to change maintenance powershell script via GPO?

    Per suggestion reposted from here: http://social.technet.microsoft.com/Forums/windowsserver/en-US/6eece9d6-a524-48aa-8e64-7554f0ec9b31/how-to-change-maintenance-powershell-script-via-gpo?forum=winserverGP
    Posted at http://answers.microsoft.com/en-us/windows/forum/windows_7-desktop/desktop-shortcuts-to-items-on-network-drives/94eddb27-342b-40fc-9ad4-677ff4ee8ebe?page=9&tm=1403700614489 originally.
    There is a very annoying "feature" in Windows 7 called BrokenShortcuts.ps1 which is being called out weekly via maintenance task and if it finds more than 4 "broken" network shortcuts it removes them all. So it means if a user at this
    moment is disconnected from the network he will lose all links to shares, network applications sitting on his desktop. Funny that there was no such script on Vista and i don't see this on Win8. On the post i have attached one user suggested to edit this script
    and change 4 to 500 or whatever high number. That's fine for one time fix. But i need to do this for 200+ users. This file cannot be simply replaced by a script, so i'm wondering is there any way to do it via GPO?
    I have already tried various startup scripts, but i'm not sure which user to put into commands.
    I need to run this on startup:
    takeown /F C:\Windows\diagnostics\scheduled\Maintenance\TS_BrokenShortcuts.ps1
    icacls c:\windows\diagnostics\scheduled\maintenance\TS_BrokenShortcuts.ps1 /grant "some user":F
    copy \\share\folder$\TS_BrokenShortcuts.ps1 C:\Windows\diagnostics\scheduled\Maintenance\ /Y

    You need to take time to study how Windows does these things.  You can control them with GP which is what you asked.  The article shows you how to disable elements of the tasks.  Each task controls a script.  If you disable the task the
    script that deletes shortcuts will be stopped. Other maintenance tasks will continue to run.
    Most of your problem is that you seem to want someone to provide a magical solution.  In technology it is necessary to fully research your issues until you understand all aspects.  After fully studying the issue you should understand the possible
    solutions if they exist.
    You claim to have deployed the patch that Microsoft released to fix the issue.  You claim it didn't work.  If that is the case then you need to call MS and \p[en a support incident.  If  Microsoft determines that you are right about the
    patch not working you will not be charged for the call.
    I know that learning how to support technology is hard and frustrating for newcomers.  In time, by using these incidents to learn, you will become a seasoned technician and all of this will seem trivial.  Until then we can only suggest that you
    do things that most of us are familiar with.  We cannot fix your network for you.
    I think you haven't really posted in the GP forum but posted a question about GP in the server forum.  Try posting in the GP forum.
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverGP
    Here is one answer from the GP forum:
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverGP
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/600ca14f-8b1b-400c-b27f-a7f5733407ac/windows-scheduled-maintenance-task?forum=winserverGP
    ¯\_(ツ)_/¯

  • SP 2013 - Use PowerShell to Deploy, Activate and Associate a SharePoint Designer Workflow

    Hello Community!
    I'm using SP 2013 Enterprise and I need to use PowerShell to deploy a reusable SharePoint Designer Workflow to the solution gallery, activate it, activate the workflow feature, and then associate the workflow to a list and or library.  Has anyone done
    this before and if so please provide guidance and code examples.
    Thanks!
    Tom
    Tom Molskow - Senior SharePoint Architect - Microsoft Community Contributor 2011 and 2012 Award -
    Linked-In - SharePoint Gypsy

    Hi Tom,
    Below are the links might help, please check:
    Lists the Windows PowerShell cmdlets that you can use to manage workflows in a SharePoint 2013 farm.
    http://technet.microsoft.com/en-us/library/ee906558(v=office.15).aspx
    Series of articles written by Sahil Malik about SharePoint 2013 workflow
    http://www.codemag.com/Article/1301021
    http://www.codemag.com/Article/1304021
    SharePoint 2013: How to Schedule a PowerShell Script to Run Automatically
    http://www.proactivespeaks.com/2013/07/30/sharepoint-2013-how-to-schedule-a-powershell-script-to-run-automatically/
    Similar threads:
    http://stackoverflow.com/questions/15045189/how-to-start-workflow-2013-from-powershell
    http://sharepoint.stackexchange.com/questions/65555/deploying-workflow-wsp-as-sandbox-solution
    http://sharepoint.stackexchange.com/questions/89312/launch-sharepoint-2013-workflow-w-javascript
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • How to export Powershell script information to Sharepoint?

    I'm trying to export information gather from a Powershell script to a Sharepoint list. I've got a couple of powershell scripts that gather general server information from a server ex: server uptime, disk space, service tag, etc. and it will export the information
    to a csv file. What I would like to do is out-put the same information gathered by the powershell scripts to a Sharepoint list directly if at all possible.
    Ex:
    # all this does is reads from a list and runs a script call "boottime.ps1"
    get-content "\\%Data-Path-Of-List%\computers.txt" | %Data-Path-Of-Script%\boottime.ps1 |  Export-csv %Data-Path-For-CSV\Computers.csv
    # then just exports the information from the boottime.ps1 script to a csv file
    #I also have a script that will upload the information to a sharepoint list.
    # I found that I have to run this in version 2 of powershell, so I just open a DOS prompt in Admin Priv's and type the following
    powershell.exe -version 2.0
    # Next I make sure the Sharepoint snap-in is loaded
    if ( (Get-PSSnapin -Name Microsoft.sharepoint.powershell - erroraction silentlycontinue) -eq $null)
    Add-PsSnapin Microsoft.Sharepoint.Powershell
    $spweb = get-SPweb $spserver
    $spdata =$spweb.getlist("%URL_Of_My_List%")
    # this is the same location from the orginal Powershell script previously stated.
    $ComputerInfoFile = "%Data-Path-For-CSV%\Computers.csv"
    foreach ($rows in $tblData) {
    # here is where I add the information from my csv file
    # 2 things needs to be present
    # 1st the colums have to be present in the sharepoint site before I can upload the information
    # 2nd the columns have to the headers in my csv file
    $spItem = $spData.AddItem()
    $SpItem["ServerName"] = $row."ServerName".toString()
    $SpItem["Uptime"] = $row."Uptime".toString()
    $SpItem.Update()
    # this just disconnects from Sharepoint
    $spWeb.Dispose()
    Please dismiss all the comments it just helps me understand what the code is doing, also if this is not the correct place to post this question I appologize in adavance and ask that if this is the incorrect place to post this question please provide me a
    link to a where I can post such questions.

    Sorry for the delay in posting this, but I ended up getting working. I'll post it in the hopes that my head scratching will save someone else some head scratching:
    I ended up writting 3 PS scripts and one batch job.
    1st Batch file
    powershell.exe -version 2.0 -command
    \\%Script-Location\Get-Server-Infor-4-SP.ps1
    powershell.exe -version 2.0 -command \\%Script-Location\Delete-list-Items.ps1"
    powershell -veriosn 2.0 -command
    \\%Script-Location\Populate-SP.ps1
    1st PS script that gets the info:
    get-content
    \\%Location-Of-My-File-With-List-Of-Servers%\%name-of-file%.txt |
    \\%Location-Of-My-Script-To-get-the-Information-I-want | Export-csv
    \\%location-of-my-output\%filename%.csv
    Ex: get-content C:\scripts\computers.txt | C:\scripts\boottime.ps1 | export-csv C:\scripts\computer.csv
    2nd PS script Delete-List-Items.ps1
    # http:
    #Script 1 Boottime.ps1:
    # This script permits to get UpTime from localHost or a set of remote Computer
    # usage
    # localHost
    # .\BootTime.ps1
    # set of remote computers
    # get-content .\MyserverList.txt | .\boottime.ps1
    # Optionally pipe output to Export-Csv, ConverTo-Html
    Process {
    $ServerName = $_
    if ($serverName -eq $Null) {
    $serverName= $env:COMPUTERNAME
    $timeVal = (Get-WmiObject -ComputerName $ServerName -Query "SELECT LastBootUpTime FROM Win32_OperatingSystem").LastBootUpTime
    #$timeVal
    $DbPoint = [char]58
    $Years = $timeVal.substring(0,4)
    $Months = $timeVal.substring(4,2)
    $Days = $timeVal.substring(6,2)
    $Hours = $timeVal.substring(8,2)
    $Mins = $timeVal.substring(10,2)
    $Secondes = $timeVal.substring(12,2)
    $dayDiff = New-TimeSpan $(Get-Date –month $Months -day $Days -year $Years -hour $Hours -minute $Mins -Second $Secondes) $(Get-Date)
    $Info = "" | select ServerName, Uptime
    $Info.servername = $servername
    $d =$dayDiff.days
    $h =$dayDiff.hours
    $m =$dayDiff.Minutes
    $s = $daydiff.Seconds
    $info.Uptime = "$d Days $h Hours $m Min $s Sec"
    $Info
    #Script 2: Delete-List-Items.ps1
    # http://markimarta.com/sharepoint/delete-all-items-in-sharepoint-list-using-powershell/
    # there seems to be a problem with running this script in version 3 or later, the workaround is to run it in version 2
    # below is the cmd for doing so, just open up a DOS prompt with Admin Privileges Start-->Run-->cmd
    # type then copy and paste the following line the DOS window then you can run this script
    #powershell.exe -version 2.0
    # make sure that the Microsoft.SharePoint.PowerShell Snap-in is installed as well
    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
    Add-PsSnapin Microsoft.SharePoint.PowerShell
    # "Enter the site URL instead http://serverurl"
    $SITEURL = "%http://serverurl%"
    $site = new-object Microsoft.SharePoint.SPSite ( $SITEURL )
    $web = $site.OpenWeb()
    "Web is : " + $web.Title
    # Enter name of the List below in the [“%List-Name%”]
    $oList = $web.Lists["%List-Name%"];
    # This echo out the name of the list its going to be deleting the records from
    "List is :" + $oList.Title + " with item count " + $oList.ItemCount
    # It’s just counting the rows/records
    $collListItems = $oList.Items;
    $count = $collListItems.Count - 1
    # Here is where it is actually deleting the records and then out put the number or the record it deleted
    for($intIndex = $count; $intIndex -gt -1; $intIndex--)
    "Deleting record: " + $intIndex
    $collListItems.Delete($intIndex);
    #Script 3: Populate-SP_Test.ps1
    # http://blogs.technet.com/b/stuffstevesays/archive/2013/07/10/3577320.aspx
    # there seems to be a problem with running this script in version 3 or later, the workaround is to run it in veriosn 2
    # below is the cmd for doing so, just open up a DOS prompt with Admin Privileges Start-->Run-->cmd
    # type then copy and paste the following line the the DOS window then you can run this script
    #powershell.exe -version 2.0
    # make sure that the Microsoft.SharePoint.PowerShell Snap-in is installed
    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
    Add-PsSnapin Microsoft.SharePoint.PowerShell
    # Here are some more varables that can be added I was not able to get this to work
    #$SPComputerInfo="/Lists/PowershellTest/"
    # Here is where we connect and Open SharePoint List via Powershell
    $SPServer= "%http://serverurl%
    $spWeb = Get-SPWeb $SPServer
    $spData = $spWeb.GetList("%List-Name%")
    # This is the variable for the path that has the file I want to input to SharePoint List
    $InvFile="\\%location-ofList%\computers.csv"
    # This is just some error checking to make sure the file exist
    $FileExists = (Test-Path $InvFile -PathType Leaf)
    if ($FileExists) {
    "Loading $InvFile for processing..."
    $tblData = import-csv $InvFile
    } else {
    "$InvFile not found - stopping import!"
    exit
    # Loop through Applications add each one to SharePoint
    "Uploading data to SharePoint...."
    foreach ($row in $tblData) {
    #Here is where I add the information from my CSV file
    #2 things have to be present
    # 1. the columns have to be in the sharepoint site before I can import the information
    # 2. columns have to the headers in my csv file
    #"Adding entry for "+$row."Computer Information".ToString()
    $spItem = $spData.AddItem()
    $spItem["ServerName"] = $row."ServerName".ToString()
    $spItem["Uptime"] = $row."Uptime".ToString()
    #$spItem["DNSHostName"] = $row."DNSHostName".ToString()
    #$spItem["DistinguishedName"] = $row."DistinguishedName".ToString()
    $spItem.Update()
    # This is just disconnecting from SharePoint
    $spWeb.Dispose()
    Enjoy, and if anyone has a better way of doing this I'm interested in knowing, thanks again
    Thanks in Adavance

Maybe you are looking for

  • Using controls in JSP

    I want to develope a web application using JSP, but I need to insert components such as buttons or sliders, in the same way Active X controls works with ASP. I don�t know how i can achieve my objective. I would very pleased if you could send me infor

  • Printing for stitching

    Hi guys, Maybe I'm just being dumb here but I've created an 8 page document that I want printed on A3 and folded and stitched so each page is A4 (in effect). How can I arrange the pages prior to printing so page 8 and 1 print on a sheet, 2 and 7, 6 a

  • SnakesAndLadders Game

    Hi Im currently writing a snakes and Ladders Game I've class Square representing a square on the board and I've a class player and some mroe classes The problem Im having is in my moveBy method in Player. Player rolls a dice and has to move by x plac

  • IMovie '11 on Mountain Lion does not see Canon Vixia HG20, Lion does

    I have 2 Canon Vixia HG20s and an HG21 that I had previously used with iMovie. When I plug the cameras into any of my Mountain Lion systems, iMovie does not see the camera to import from. On my MacBook it only sees the EyeSight camera. I know I had i

  • Downloading "lost" episode error message

    Hi I'm trying to download a "Lost" episode called "What Kate Did" and it downloads fine until the end when it gives me this error message: There was an error downloading your purchased music. An unknown error occurred (0xFFFE7958). Us the Check for P