<?xml version="1.0"?>
<rss version="2.0"><channel><title>scripting Latest Questions</title><link>https://www.windows-noob.com/forums/forum/40-scripting/</link><description>scripting Latest Questions</description><language>en</language><item><title>[Help] - Powershell script SMSTSPostAction</title><link>https://www.windows-noob.com/forums/topic/21717-help-powershell-script-smstspostaction/</link><description><![CDATA[
<p>
	<span style="background-color:#ffffff;color:#1a1a1b;font-size:14px;">I need to install Symantec Endpoint Protection, what would the command line be like in powershell where I can call a .ps1 script in a completely hidden and silent way?</span>
</p>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" href="https://www.windows-noob.com/forums/uploads/monthly_2020_11/image.png.5769b2c027463157c2e0a850e2675919.png" data-fileid="21875" data-fileext="png" rel=""><img class="ipsImage ipsImage_thumbnailed" data-fileid="21875" data-ratio="116.46" width="644" alt="image.thumb.png.40b2774d856adb957f40c8054b9ac79b.png" src="https://www.windows-noob.com/forums/uploads/monthly_2020_11/image.thumb.png.40b2774d856adb957f40c8054b9ac79b.png" /></a>
</p>

<p style="background-color:#ffffff;border:0px;color:#1a1a1b;font-size:14px;padding:.8em 0px .25em;vertical-align:baseline;">
	I did a previous TS that copies the setup64.exe from SEP to "C:\TEMP\" I don't have much knowledge on powerhsell as would the script that would install it silently? the argument for installing it via Batch File is / s. However, the CMD window appears during Windows logon, and Powershell can do all of this without any windows appearing, and I wanted powershell to wait for the installation to finish (I researched this and think the parameter is -WaitProcess but I don't know where how to put it) and after the installation is finished, delete the TEMP folder and restart the computer.
</p>

<p style="background-color:#ffffff;border:0px;color:#1a1a1b;font-size:14px;padding:.8em 0px .25em;vertical-align:baseline;">
	Any help with that please?
</p>
]]></description><guid isPermaLink="false">21717</guid><pubDate>Sun, 29 Nov 2020 20:45:38 +0000</pubDate></item><item><title>Clear ConfigMgr Client Cache PS</title><link>https://www.windows-noob.com/forums/topic/23210-clear-configmgr-client-cache-ps/</link><description><![CDATA[<p>
	This may very well overlap a few topics but I have a need for a PS script that I can assign to a Configuration Item and a Configuration Baseline. I have the PS scripts but need advice how to run the script as it fails due to the fact by default CM Clients run at the level of All Signed.
</p>

<p>
	I thought I could just add at line 1 Set-ExecutionPolicy ByPass within the remediation script as follows
</p>

<p>
	Set-ExecutionPolicy ByPass<br />
	$MinDays = 14<br />
	$UIResourceMgr = New-Object -ComObject UIResource.UIResourceMgr<br />
	$Cache = $UIResourceMgr.GetCacheInfo()<br />
	$Cache.GetCacheElements()|<br />
	where-object {[datetime]$_.LastReferenceTime -lt (get-date).adddays(-$mindays)}| foreach {$Cache.DeleteCacheElement($_.CacheElementID)}
</p>

<p>
	 
</p>

<p>
	Any advice on if anyone has a better way of doing this.
</p>

<p>
	 
</p>

<p>
	Issue to resolve is the Client Cache length of time that the cache stays in the Client\Cache\CCMCache folder chewing up disk space. Especially on Servers that have been provisioned with only 80GB primary partitions.
</p>
]]></description><guid isPermaLink="false">23210</guid><pubDate>Tue, 14 Mar 2023 19:00:17 +0000</pubDate></item><item><title>PowerShell script to protect Task Sequence</title><link>https://www.windows-noob.com/forums/topic/23185-powershell-script-to-protect-task-sequence/</link><description><![CDATA[<p>
	I am trying to create a simple PowerShell script to protect a specific Task Sequence with a password. <span style="background-color:#ffffff;color:#515164;font-size:16px;">Any help is going to be appreciated.  <img alt=":)" data-emoticon="" height="20" src="https://www.windows-noob.com/forums/uploads/emoticons/default_smile.png" srcset="https://www.windows-noob.com/forums/uploads/emoticons/smile@2x.png 2x" title=":)" width="20" /></span>
</p>

<p>
	<span style="background-color:#ffffff;color:#515164;font-size:16px;">SCCM 2207.</span>
</p>

<p>
	Thank you!
</p>
]]></description><guid isPermaLink="false">23185</guid><pubDate>Thu, 02 Feb 2023 17:07:05 +0000</pubDate></item><item><title>How to create a shortcut to the desktop or start menu? The target and starting position are grayed out</title><link>https://www.windows-noob.com/forums/topic/22765-how-to-create-a-shortcut-to-the-desktop-or-start-menu-the-target-and-starting-position-are-grayed-out/</link><description><![CDATA[<p>
	After the earlier version of office is installed, it has a gray status that cannot be modified. I want to create a desktop shortcut to prevent users from modifying information like this. How should I create a desktop shortcut with PowerShell, and the target and starting position are in a gray status that cannot be modified?
</p>

<p>
	 
</p>

<p>
	<img class="ipsImage ipsImage_thumbnailed" data-fileid="23032" data-ratio="128.54" width="417" alt="117705846_1.jpg.563265c9d03c0df0b5aacc0e2fb48eb8.jpg" src="https://www.windows-noob.com/forums/uploads/monthly_2022_03/117705846_1.jpg.563265c9d03c0df0b5aacc0e2fb48eb8.jpg" /></p>
]]></description><guid isPermaLink="false">22765</guid><pubDate>Tue, 01 Mar 2022 03:20:01 +0000</pubDate></item><item><title>Strings</title><link>https://www.windows-noob.com/forums/topic/22672-strings/</link><description><![CDATA[<p>
	<br />
	I have a string
</p>

<p>
	<strong>CIM_Chassis (CreationClassName = "CIM_DockingStation", Tag = "ABCD1234")</strong>
</p>

<p>
	How do I get just the ABCD1234 ?  I have 2 equal signs and 2 sets of quotes and that is messing me up.
</p>

<p>
	Any help would be great.<br />
	 
</p>
]]></description><guid isPermaLink="false">22672</guid><pubDate>Wed, 24 Nov 2021 15:27:40 +0000</pubDate></item><item><title>Methods in PowerShell</title><link>https://www.windows-noob.com/forums/topic/22655-methods-in-powershell/</link><description><![CDATA[<p>
	Hello, I had a question on PowerShell Version: 5.1.19041.1023
</p>

<p>
	If you look at the attached screenshot you'll see what I'm curious about.   I run this command in PowerShell ISE:
</p>

<p>
	<strong>Get-CimInstance -ClassName win32_computersystem -Property *  | Get-Member -MemberType Method</strong>
</p>

<p>
	You see what it displays in the display window.
</p>

<p>
	But when I run WEBMTEST and I choose OPEN CLASS and then Win32_ComputerSystem you'll notice the METHODS don't match what you see in the ISE command.
</p>

<p>
	My question is why?  
</p>

<p>
	Thank you.
</p>

<p><a href="https://www.windows-noob.com/forums/uploads/monthly_2021_11/CIMV2.PNG.7cf4774d3c8321df50df1464d1d4845e.PNG" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="22757" src="https://www.windows-noob.com/forums/uploads/monthly_2021_11/CIMV2.thumb.PNG.bf857636239b6d8623ee52d4a95c722e.PNG" data-ratio="37.9" width="1000" class="ipsImage ipsImage_thumbnailed" alt="CIMV2.PNG"></a></p>]]></description><guid isPermaLink="false">22655</guid><pubDate>Tue, 02 Nov 2021 15:55:53 +0000</pubDate></item><item><title>Batch Script vs PowerShell</title><link>https://www.windows-noob.com/forums/topic/22281-batch-script-vs-powershell/</link><description><![CDATA[<p>
	Hi Guys, Am not too good with batch script and PowerShell and am trying to amend an existing batch script to do a certain install but I keep 
</p>

<p>
	getting "system error 55 has occurred" on the network drive path of the line, and also " error code 1605" for the install command part of the script 
</p>

<p>
	I am trying to find a way to re write the scrip using PowerShell. the main action is to perform an install of an application which upgrades or updates
</p>

<p>
	the current application to  new version on the local server. I want to re use the same script for other devices too. 
</p>

<p>
	 
</p>

<p>
	I hope the above makes some sense. 
</p>]]></description><guid isPermaLink="false">22281</guid><pubDate>Sat, 10 Apr 2021 19:17:18 +0000</pubDate></item><item><title>Install Offline Language Pack on Windows 10 1909</title><link>https://www.windows-noob.com/forums/topic/21414-install-offline-language-pack-on-windows-10-1909/</link><description><![CDATA[
<p>
	Hi,
</p>

<p>
	How can I install a language packs on windows 10 1909 using PowerShell offline? These machines do not have access to Microsoft stores to download the language pack online.
</p>

<p>
	What files are needed from the FOD?<br />
	how do I find which files belong to language pack and which files are for something else?
</p>

<p>
	I need around 16 different languages
</p>

<p>
	I already download the FOD but everything is in one folder. I try to install the Client_de cab but that doesnt install all other features like, keyboard, speech
</p>

<p>
	We have more then 4000 machine to do this on, I will be using sccm to do this but need to make sure all of the languages and script are avaiable locally so this can be done off the network including VPN users
</p>
]]></description><guid isPermaLink="false">21414</guid><pubDate>Mon, 28 Sep 2020 14:20:21 +0000</pubDate></item><item><title>ps extraction path specific name syntax problem</title><link>https://www.windows-noob.com/forums/topic/20684-ps-extraction-path-specific-name-syntax-problem/</link><description><![CDATA[
<p>
	$a = "C:\Program Files (x86)\Google\Chrome\Application\80.0.3987.149\Installer\setup.exe --uninstall --system-level --verbose-logging"<br />
	$a -replace '([^\\]*)$'  
</p>

<p>
	Suppose my condition is like this<br />
	How do I extract the desired folder name
</p>

<p>
	$b = $a  -replace '([^\\]*)$'  
</p>

<p>
	$b = google<br />
	or<br />
	$b =chrome<br />
	or <br />
	$b = Application 
</p>
]]></description><guid isPermaLink="false">20684</guid><pubDate>Thu, 02 Apr 2020 11:10:37 +0000</pubDate></item><item><title>Powershell - How to create multiple Deployment Types</title><link>https://www.windows-noob.com/forums/topic/17139-powershell-how-to-create-multiple-deployment-types/</link><description><![CDATA[
<p>
	Is there a way to create multiple Deployment Types under <span style="font-size:14px;">one </span>application. I am using <span style="font-size:14px;"><font color="#0000ff" face="Lucida Console"><font color="#0000ff" face="Lucida Console"><font color="#0000ff" face="Lucida Console">Add-CMScriptDeploymentType </font></font></font><font face="Lucida Console"><font face="Lucida Console"><font face="Lucida Console">and get an error<span style="font-size:14px;"><font face="Lucida Console"><font face="Lucida Console"><font face="Lucida Console"> on the second one</font></font></font></span>.</font></font></font></span>
</p>

<p>
	Add-CMScriptDeploymentType : ConfigMgr Error Object:<br />
	instance of SMS_ExtendedStatus<br />
	{<br />
	        Description = "The digest is not valid";<br />
	        ErrorCode = 1078462235;<br />
	        File = "..\\sspconfigurationitem.cpp";<br />
	        Line = 1980;<br />
	        Operation = "PutInstance";<br />
	        ParameterInfo = "";<br />
	        ProviderName = "ExtnProv";<br />
	        SQLMessage = "[42000][3998][Microsoft]</p>
<pre class="ipsCode">[SQL Server]Uncommittable transaction is<br />
	detected at the end of the batch. The transaction is rolled back.";<br />
	        SQLSeverity = 16;<br />
	        SQLStatus = 3998;<br />
	        StatusCode = 2147749889;<br />
	};<br />
	At C:\Install\CreateTKA.ps1:252 char:11<br />
	+           Add-CMScriptDeploymentType -ApplicationName $ApplicationNam ...<br />
	+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
	    + CategoryInfo          : NotSpecified: (Microsoft.Confi...mentTypeCommand:AddScriptDeploymentTypeCommand) [Add-CM<br />
	   ScriptDeploymentType], WqlQueryException<br />
	    + FullyQualifiedErrorId : UnhandledException,Microsoft.ConfigurationManagement.Cmdlets.AppMan.Commands.AddScriptDe<br />
	   ploymentTypeCommand
</pre>
]]></description><guid isPermaLink="false">17139</guid><pubDate>Mon, 24 Jun 2019 22:06:44 +0000</pubDate></item><item><title>Powershell Script - Onboarding new users</title><link>https://www.windows-noob.com/forums/topic/20176-powershell-script-onboarding-new-users/</link><description><![CDATA[<p>
	<span style="background-color:#f3f6f8;color:rgba(0,0,0,.9);font-size:14px;text-align:left;">I’m currently working on a user Onboarding script as the company can not afford a system to automate etc and want to check if you can help me on something which I cannot figure out? On a nutshell we have 4 different sites and each Location has its own OU for user accounts. We have departmental shares like IT, Accounts etc n want to add newly created to their respective department group and lastly distribution group based on location. Can you please help me a script for this if possible? I am able to create users but not able to add users based on departments also to the distribution group based on location Searched online could not find much Appreciate the help. Thank you</span>
</p>]]></description><guid isPermaLink="false">20176</guid><pubDate>Sun, 24 Nov 2019 23:37:20 +0000</pubDate></item><item><title>SMS_AppDeploymentAssetDetails is returning multiple recored per device</title><link>https://www.windows-noob.com/forums/topic/19827-sms_appdeploymentassetdetails-is-returning-multiple-recored-per-device/</link><description><![CDATA[
<p>
	Hi all,
</p>

<p>
	To do some reporting around app deployment for our classrooms, I'm WMI-querying class SMS_AppDeploymentAssetDetails. Unfortunately, it returns multiple records per device. Does anyone know how get back only the most recent record of a device?<br /><br />
	Thank you in advance!
</p>

<p>
	 
</p>

<p>
	Regars,<br />
	Sven
</p>
]]></description><guid isPermaLink="false">19827</guid><pubDate>Mon, 02 Sep 2019 09:23:27 +0000</pubDate></item><item><title>Need to rename PC during OSD</title><link>https://www.windows-noob.com/forums/topic/19797-need-to-rename-pc-during-osd/</link><description><![CDATA[
<p>
	Hi all, I need some help and it might be something easy. I have no scripting skills and tried various methods on the internet but it's not working.
</p>

<p>
	All I want is for the TS to ask me what computer name I want for the deployment, some sort of popup.
</p>
]]></description><guid isPermaLink="false">19797</guid><pubDate>Fri, 23 Aug 2019 04:54:07 +0000</pubDate></item><item><title>Book recommendation: ConfigMgr - An Administrator's Guide to Deploying Applications using PowerShell</title><link>https://www.windows-noob.com/forums/topic/16649-book-recommendation-configmgr-an-administrators-guide-to-deploying-applications-using-powershell/</link><description><![CDATA[
<p>
	Hi,
</p>

<p>
	I thought I would advertise my book here as I need all the shout-outs I can get!
</p>

<p>
	The book is entitled: <strong>ConfigMgr - An Administrator's Guide to Deploying Applications using PowerShell</strong>
</p>

<p>
	I think it's pretty good, but then again, I'm probably biased.
</p>

<p>
	You can get it here: <a href="https://leanpub.com/configmgr-DeployUsingPS" rel="external nofollow">https://leanpub.com/configmgr-DeployUsingPS</a> 
</p>

<p>
	Sorry about this advert - I hate adverts too. Sometimes, you just...gotta.
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">16649</guid><pubDate>Thu, 25 Apr 2019 16:05:34 +0000</pubDate></item><item><title>Connect-ConfigMgr64 - Function to connect to CMSite (SCCM) # Feedback for Improvement?</title><link>https://www.windows-noob.com/forums/topic/16422-connect-configmgr64-function-to-connect-to-cmsite-sccm-feedback-for-improvement/</link><description><![CDATA[
<p>
	Hi WN
</p>

<p>
	I created a function to connect to the CMSite and load the cmdlet for <span style="color:#000000;font-size:13.008px;">ConfigurationManager.</span>
</p>

<p>
	<font color="#000000"><span style="font-size:13.008px;">Could the function be improved in any way or is it as good it can be? is the logic best practice or?</span></font>
</p>

<p>
	<font color="#000000"><span style="font-size:13.008px;">You can download it at : <a href="https://gallery.technet.microsoft.com/Connect-ConfigMgr64-db5e9d0a" rel="external nofollow">https://gallery.technet.microsoft.com/Connect-ConfigMgr64-db5e9d0a</a></span></font>
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">function Connect-ConfigMgr64
{
	$initParams = @{ }
	if ((Get-Module ConfigurationManager) -eq $null)
	{
		try
		{
			Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" @initParams -Scope Global
		}
		catch
		{
			$ModulePath = (Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\ConfigMgr10\Setup -Name "UI Installation Directory").'UI Installation Directory'
			Import-Module $ModulePath\bin\ConfigurationManager.psd1 -Scope Global
		}
	}
	if ((Get-Module ConfigurationManager) -ne $null)
	{
		$SiteCode = Get-PSDrive -PSProvider CMSITE
		if ((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null)
		{
			$ProviderMachineName = (Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\ConfigMgr10\AdminUI\Connection -Name Server).Server
			New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName @initParams
		}
		if ((Get-PSProvider -PSProvider CMSite) -ne $null)
		{
			Set-Location $SiteCode":\"
			Write-Host 'Type "Get-Command -Module ConfigurationManager" for a list of SCCM CMDlets.' -ForegroundColor Green
		}
		else
		{
			$CustomError = [String]"Error: Can't find CMSite provider"
			Throw $CustomError
		}
	}
	else
	{
		$CustomError = [String]"Unable to locate System Center Configuration Manager installation folder!"
		Throw $CustomError
	}
}

Connect-ConfigMgr64</span></pre>

<p>
	 
</p>
]]></description><guid isPermaLink="false">16422</guid><pubDate>Wed, 24 Oct 2018 07:35:01 +0000</pubDate></item></channel></rss>
