In my opinion it's gonna be better if you put here link to google drive where you store this commands cheat sheet
@hjoseph777 Жыл бұрын
Excellent tutorial
@abraheemyasin48172 жыл бұрын
Concise video, Thank you
@mohinkh7632 жыл бұрын
I want to move all txt files to CSV files
@curemymind2 жыл бұрын
I use .bat and need to use the same variable in a PowerShell... Also, good when I need to run a PowerShell script without enabling scripting and simply tell cmd to elevate and run the ps1 file as unrestricted... I use to use a for each from csv file which I would output to have my PS1 file run... I have corrected this but now I know more about this type of scripting. Thank you.
@sanpcsnd2 жыл бұрын
Hello! Could you, please, help me with this error, Exception setting "ConnectionString": "Format of the initialization string does not conform to specification starting at index 75.".? I have followed the same connectionString syntax.
@audiofrank67472 жыл бұрын
Thank you so much!
@spekkio38642 жыл бұрын
Thank you a lot for your video. For the moment, I haven't watch all your video, (only 12 min) but, I'm already able to do more than half of my Xml project
@Manisood0013 жыл бұрын
please share a document of all demos if possible
@heikohorn3 жыл бұрын
github.com/hhorn76/PowerShell/tree/master/KZbin
@het990091973 жыл бұрын
Hello, how did you just changed the color of the text or replace the text as well? Can you provide the source code for this.. Thank you
@DucTrann103 жыл бұрын
what if i want to have only #text in a specific property, but dont include the property name in it? I mean what should i do if i only want "IT" in Department property? Thanks
@ashishbirajdar75333 жыл бұрын
What decides parameter values?
@ahmedatef2213 жыл бұрын
please from where get source code of foreach-objectperformance.ps1 or who to get for every command?
@heikohorn3 жыл бұрын
Hey, here you can find the code for all the videos: github.com/hhorn76/PowerShell/tree/master/KZbin
@ahmedatef2213 жыл бұрын
hey please, I want to ask a question what is the meaning of if($string) for example what the corresponding of it? when I try if ($string -eq $true) get wrong answer and if($string -eq $null)
@heikohorn3 жыл бұрын
Hey, if($string) will just check if the variable has a value. here are some examples: $string = 'TEST' if ($string) { Write-Host "String has a value" } else { Write-Host "String has NO value" } $string = '' if ($string) { Write-Host "String has a value" } else { Write-Host "String has NO value" }
@AhmedAli-dz1hy3 жыл бұрын
Best one who explain powershell pipeline
@bhargavendrad2063 жыл бұрын
Hi.. How to set ACL for AD groups. I mean I want to add owners to the security tab of an AD group using powershell. Please help.
@ChaseTran3 жыл бұрын
The switch example as the end is kind of wrong. From the command line, you should just pass the switch or the param name with no value of true/false. Otherwise, great video. Thank you!
@krishna1722253 жыл бұрын
I am working on the script to check if service is started if not then start it. I know how to check and restart services but the whole concept is I need to check 3 services and for one of the services I need to put some time frame such as 10 sec and then make sure that run and check others two then also all 3 send out the email. Does anyone know how how to add time-delayed one of the services out of theree and restart the service. Thank you!
@heikohorn3 жыл бұрын
You could use the following: # please replace the xxx with values # create an array of services $arrName = @('spooler','xxx','xxx') # check each service and restart it foreach ($name in $arrName) { if ((Get-Service -Name $name).Status -eq 'Running') { Restart-Service -Name $name } } # wait for 10 seconds Start-Sleep 10 # check each service again and send an email if running foreach ($name in $arrName) { if ((Get-Service -Name $name).Status -eq 'Running') { Send-MailMessage -to xxx -from xxx -SmtpServer xxx } }
@krishna1722253 жыл бұрын
@@heikohorn thanks
@FapilsonAndrade-rz3wv4 жыл бұрын
buen tutorial de power shell.
@Jamesaepp4 жыл бұрын
Thanks, found the solution to my problem!
@vaibhavthakare20764 жыл бұрын
Thanks Heiko, great video man I have two CSV file and I need to merge them on the basis of common parameter present in both the csv file , Any help would be appreciated...
@velo13373 жыл бұрын
just load them into the same variable
@jasonubrown5 жыл бұрын
Great explanation. Still a beginner, I've been trying to wrap my head around loops and other principals. This really broke it down. Thank you
@wminioinimw5 жыл бұрын
I've learn a lot, appreciate
@Kazashimo15 жыл бұрын
Very clear instructions, thank you!
@ClevergunsYT5 жыл бұрын
this channel deserves a million subs
@ramialz27935 жыл бұрын
wow, amazing man respect!
@jhillyt5 жыл бұрын
Good Stuff Heiko
@ralphmalone83375 жыл бұрын
I need simple operations performed on a CSV (part of a simple ETL process).. Anyone know where I can hire a powershell guru ? Seriously, I'd pay through paypal..
@heikohorn5 жыл бұрын
You have found your guru... what do you need?
@ralphmalone83375 жыл бұрын
@@heikohorn hello there. Do you have an email so I can send you a before and after sample? I can manually make one up to illustrate.. Its not very complex basically breaking out the Debit and Credit column on a bank download, and making both values positive.. This particular bank combines credits and debits having the debits negative ( noobs lol)..
I literally fell asleep watching this. I did come back today and finish it. It was quite good. I think you could have started with the demo portion.
@tanneremery92973 жыл бұрын
i realize it's kinda randomly asking but do anybody know a good website to stream new movies online ?
@brentleyford89193 жыл бұрын
@Tanner Emery Flixportal
@tanneremery92973 жыл бұрын
@Brentley Ford thanks, signed up and it seems like a nice service :) I really appreciate it !
@brentleyford89193 жыл бұрын
@Tanner Emery happy to help =)
@parthabura5 жыл бұрын
HI Heiko, Can i have your email address ? I have certain doubts on a PS which i have wrote. need your input. I will send the code to you in an email
@jeremypenning6285 жыл бұрын
is it me or do you type the foreach object wrong??? i see for-eachobject but PS recognize only foreach-object
@Spoutinwyze6 жыл бұрын
i must be retarded, ive been at this for 2 days trying to figure out how to combine two text files and just dont grasp this language
@heikohorn6 жыл бұрын
The easiest way to output two text fields is to to use the following syntax: Write-Host "$($obj.Id) - $($obj.Name)" Please note to use the brackets and dollar symbols within the apprentices.
@LJ-lu9ei6 жыл бұрын
Many thanks this helped me to get fully grasp and understand pipeline
@biyasyoutubechannel63166 жыл бұрын
Excellent tutorial -- your examples are very well done. Thanks.
@Johnwild61526 жыл бұрын
Bad examles
@jhj7866 жыл бұрын
not teaching much. Thanks anyway....
@ShrichandraYadav6 жыл бұрын
Awesome, so crisp and to the point. Awesome. thank you so much
@roycharman74126 жыл бұрын
Great videos, dare I say better than the Microsoft ones in some respect as you're straight to the point! Instead of talking about your self for half an hour
@kimfucku80746 жыл бұрын
So the parameter names are basically useless as long as you provide all parameters. If you have 5 possible parameters (not mandatory) but you only have values for 2, the names have to be used.
@UmaYasoda6 жыл бұрын
Hi Heiko, Nice video. One question- After create Event where can I see that log file
@UmaYasoda7 жыл бұрын
How can I connect MS Access database using Power Shell
@heikohorn7 жыл бұрын
Here are two ways to connect to an Access Database: #Using ADODB.Connection $intOpenStatic=3 $intLockOptimistic=3 $strDb="C:\temp\Database1.accdb" $objConnection=New-Object -ComObject ADODB.Connection #Connection for Access 2007 and earlier $objConnection.Open("Provider = Microsoft.Jet.OLEDB.4.0;Data Source=$strDb") #Connection for Access 2010 - 2016 $objConnection.Open("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = $strDb") $objRecordSet=New-Object -ComObject ADODB.Recordset $strQuery="Select Field1 from Test" $objRecordSet.Open($strQuery, $objConnection, $intOpenStatic, $intLockOptimistic) $objRecordset.GetRows() $objRecordset.Close() $objConnection.Close() #Using System.Data.SqlClient.SqlConnection $strDb="C:\temp\Database1.accdb" $strQuery="Select * from Test" $objConnection=New-Object System.Data.OleDb.OleDbConnection $objConnection.ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0; Data Source=$strDb" $objConnection.Open() $objCommand=New-Object System.Data.OleDb.OleDbCommand $objCommand.Connection=$objConnection $objCommand.CommandText=$strQuery $objCommand.ExecuteNonQuery() $reader=$objCommand.ExecuteReader() while ($reader.read()) { $reader.GetValue(0)#get the first column } $reader.close() $objConnection.close()
@UmaYasoda7 жыл бұрын
Hi Heiko, Thank you for your reply. I tried for first approach, it's throwing an error as " New-Object-ComObject :The term 'New-Object-ComObject' is not recognized as the name of a cmdlet, function, script file or operable program. I am working on my current assignment as "to send the CSV file data to MS Access 2003 using Power Shell". Please help on this.
@UmaYasoda7 жыл бұрын
Hi Heiko, I am trying with the below code to insert data from csv to ms access 2003 using Power Shell conn1.ps1:- $connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\db1.mdb" $conn=New-Object System.Data.Oledb.OledbConnection($connectstring) $conn.Open() $Users=Import-Csv -Delimiter "," -Path "C:\Users\users.csv" foreach ($User in $Users) { $first=$User.first $last=$User.last $cmd=$conn.CreateCommand() $cmd.CommandText="INSERT INTO Table1('$first','$last')" $cmd.ExecutionNonQuery() } $conn.close() ============================== After executing the above script getting the below error:- Exception calling "Open" with "0" arguments(s) :"The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. +At line:1 char:1 +$conn.open() +------------------- + CategoryInfo :NotSpecified: (:) [], MethodInvocationException +FullQualifiedErrorid:InvlidOperationException ===================================== Please suggest on this how to resolve.
@heikohorn7 жыл бұрын
+uma d Is Office 2003 installed on the Computer you are running PowerShell on?
@UmaYasoda7 жыл бұрын
Heiko Horn yes it's installed
@UmaYasoda7 жыл бұрын
Excellent Demonstration
@GaryJohnWalker17 жыл бұрын
I'm surprised at the low number of views. These are excellent bitesize tutorials on PS that get to the point and are probably more useful for most people than the lengthy courses on the likes of pluralsight.
@ashutoshchaturvedi33707 жыл бұрын
I have a script Like $action=New-ScheduledTaskAction -Execute ''D:\T\TestApp_Test_Prod.exe' -Argument 'D:\TestFolder' $trigger=New-ScheduledTaskTrigger -Daily -At 9:20pm Register-ScheduledTask -Action $action -Trigger -TaskName "TestAppLog" -Description "For Testing" The moment i run using Powershell it says Terminator is missing at 'D:\TestFolder' what could be the issue?
@heikohorn7 жыл бұрын
+Ashutosh Chaturvedi You are using double quotes to start the String for the Execute parameter, but are closing it with a single quote. Close it with a double quote. If you use a single quote, PowerShell will force the text in quotes to be a sting. If you use a single quote, you could still add variables.
@heikohorn7 жыл бұрын
Here is an example: $strTest="Test String" Write-Host "Example $strTest" Will output Example Test String Write-Host 'Example $strTest' Will output Example $strTest Make sure you use either one, depending on the results you would like to have...
@adnan-khan7 жыл бұрын
This is a brilliant video in fact all your videos are so easy to understand. Thank you for taking the time to make these high quality, easy to understand and well presented videos.
@ClarkKent10167 жыл бұрын
This will be very useful to me. Thanks for sharing.
@KRoc7 жыл бұрын
Do you have this ps1 file on github?
@heikohorn7 жыл бұрын
github.com/hhorn76/PowerShell
@dieknisterkatze48065 жыл бұрын
@@KRoc #XPath Predicates /root/node[1] /root/node[last()] /root/node[last()-1] /root/node[position()<3] //node[@attribute] //node[@attribute=value] /root/node[attribute>value] /root/node[attribute->value]/node #Get-Content Get-Content -Path $strXml #Opening XML files Invoke-Expression -Command $strXml Invoke-Item -Path $strXml #Reading Nodes from XML Select-Xml -Path "//node" $xml.root.node.node.attribute $xml.SelectSingleNode("//node[3]") $xml.SelectNodes("root/node/node") #ConverTo-Xml ConvertTo-Xml -InputObject $obj $obj | ConvertTo-Xml #Writing to a XML File $xml.Save($strXmlFilePath) #Export-Clixml $obj | Export-Clixml -Path $strXml #Import-Clixml Import-Clixml -Path $strXmlFilePath #Creating Xml $xml = New-Object -TypeName XML $xmlRoot = $xml.CreateElement($strName) $xml.AppendCild($xmlRoot) $xmlRoot.SetAttribute($strName, $strValue) $xmlL1 = xmlRoot.AppendChild($xml.CreateElement($strName)) #Remove Nodes form XML $nodes = $xml.selectNodes("$strXPath") Foreach ($item in $nodes) { $item.ParentNode.RemoveChild ($item)} #Remove All Nodes from XML $xml.ChildNodes.RemoveAl() #Replace Nodes in XML $oldNode = $xml.SelectSingleNode("//$($strRoot)[last()]") $newNode = $xml.CreateElement($strNode) $newNode.SetAttribute($strAttribute, $strValue) $xml.root.node.ReplaceChild($newNode, $oldNode)