<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.itcollege.ee/index.php?action=history&amp;feed=atom&amp;title=PowerShell%3A_Rene_P%C3%A4rnpuu%2C_Printerid.ps1</id>
	<title>PowerShell: Rene Pärnpuu, Printerid.ps1 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.itcollege.ee/index.php?action=history&amp;feed=atom&amp;title=PowerShell%3A_Rene_P%C3%A4rnpuu%2C_Printerid.ps1"/>
	<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=PowerShell:_Rene_P%C3%A4rnpuu,_Printerid.ps1&amp;action=history"/>
	<updated>2026-05-10T08:59:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=PowerShell:_Rene_P%C3%A4rnpuu,_Printerid.ps1&amp;diff=32690&amp;oldid=prev</id>
		<title>Rparnpuu: /* Skript */</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=PowerShell:_Rene_P%C3%A4rnpuu,_Printerid.ps1&amp;diff=32690&amp;oldid=prev"/>
		<updated>2011-05-24T07:44:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Skript&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:44, 24 May 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &amp;quot;Printer: $nimi&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &amp;quot;Printer: $nimi&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &amp;quot;Shared: $shareStatus&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &amp;quot;Shared: $shareStatus&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &quot;ShareName: $shareName&quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     &quot;ShareName: $shareName&quot; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rparnpuu</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=PowerShell:_Rene_P%C3%A4rnpuu,_Printerid.ps1&amp;diff=32689&amp;oldid=prev</id>
		<title>Rparnpuu: Created page with &#039;==Kirjeldus==  Skript otsib lokaalsest arvutist ülesse kõik installeeritud printerid ja shareb kõikidele kasutajatele antud arvutis. &#039;&#039;&#039;gwmi win32_printer&#039;&#039;&#039; leiab kõik insta…&#039;</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=PowerShell:_Rene_P%C3%A4rnpuu,_Printerid.ps1&amp;diff=32689&amp;oldid=prev"/>
		<updated>2011-05-24T07:43:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;==Kirjeldus==  Skript otsib lokaalsest arvutist ülesse kõik installeeritud printerid ja shareb kõikidele kasutajatele antud arvutis. &amp;#039;&amp;#039;&amp;#039;gwmi win32_printer&amp;#039;&amp;#039;&amp;#039; leiab kõik insta…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Kirjeldus==&lt;br /&gt;
&lt;br /&gt;
Skript otsib lokaalsest arvutist ülesse kõik installeeritud printerid ja shareb kõikidele kasutajatele antud arvutis. &amp;#039;&amp;#039;&amp;#039;gwmi win32_printer&amp;#039;&amp;#039;&amp;#039; leiab kõik installeeritud printerid ning tänu filtrile võtame ainult lokaalsed. &amp;#039;&amp;#039;&amp;#039;foreach&amp;#039;&amp;#039;&amp;#039;iga laseme kõik printerid läbi ja tekitame sharename. Sharenamega probleemide vältimiseks asendame tühikud ja imesümbolid märgiga &amp;#039;_&amp;#039;&lt;br /&gt;
&lt;br /&gt;
==Skript==&lt;br /&gt;
&lt;br /&gt;
$printerid = gwmi win32_printer -filter &amp;quot;local=&amp;#039;$true&amp;#039;&amp;quot;&lt;br /&gt;
foreach ($printer in $printerid) &lt;br /&gt;
{&lt;br /&gt;
    $nimi = $printer.Name&lt;br /&gt;
    $chars = &amp;#039;:&amp;#039;, &amp;#039;?&amp;#039;, &amp;#039;/&amp;#039;, &amp;#039;\&amp;#039;, &amp;#039;*&amp;#039;, &amp;#039;&amp;lt;&amp;#039;, &amp;#039;&amp;gt;&amp;#039;, &amp;#039;|&amp;#039;, &amp;#039;&amp;quot;&amp;#039;, &amp;#039; &amp;#039;&lt;br /&gt;
    foreach ($char in $chars) {&lt;br /&gt;
    while ($nimi.Contains($char)) {&lt;br /&gt;
      $nimi = $nimi -replace $char,&amp;#039;_&amp;#039;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    IF ($printer.ShareName -eq $Null)&lt;br /&gt;
    {&lt;br /&gt;
    $printer.ShareName = &amp;quot;share_$nimi&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
    IF (!$printer.Shared)&lt;br /&gt;
    {&lt;br /&gt;
    $printer.Shared = &amp;quot;True&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
    $shareStatus = $printer.Shared&lt;br /&gt;
    $shareName = $printer.ShareName&lt;br /&gt;
    &amp;quot;Printer: $nimi&amp;quot;&lt;br /&gt;
    &amp;quot;Shared: $shareStatus&amp;quot;&lt;br /&gt;
    &amp;quot;ShareName: $shareName&amp;quot;&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Rparnpuu</name></author>
	</entry>
</feed>