{"id":250,"date":"2016-05-05T15:15:04","date_gmt":"2016-05-05T15:15:04","guid":{"rendered":"https:\/\/sysadminnightmare.com\/?p=250"},"modified":"2016-05-05T15:16:04","modified_gmt":"2016-05-05T15:16:04","slug":"powershell-breaking-a-command-down-to-multi-lines","status":"publish","type":"post","link":"https:\/\/sysadminnightmare.com\/index.php\/2016\/05\/05\/powershell-breaking-a-command-down-to-multi-lines\/","title":{"rendered":"Powershell &#8211; breaking a command down to multilines"},"content":{"rendered":"<p>So yeah .. I like things to be neat and clean and having a single line command in powershell is the norm for a lot of people. <\/p>\n<p>Example:<br \/>\n<code>New-MailContact -DomainController $dc -Name $alias.ContactName -ExternalEmailAddress  $alias.ExternalEmailAddress -Alias $alias.ContactAlias -FirstName $alias.FirstName -Initials '' -LastName  $alias.LastName -OrganizationalUnit $OU<\/code><\/p>\n<p>But like stated I like things neat(er). So use the ` character at the end of a line to tell Powershell to treat it as the same line.<\/p>\n<p>Example<br \/>\n<code>    New-MailContact `<br \/>\n        -DomainController $dc `<br \/>\n        -Name $alias.ContactName `<br \/>\n        -ExternalEmailAddress $alias.ExternalEmailAddress `<br \/>\n        -Alias $alias.ContactAlias `<br \/>\n        -FirstName $alias.FirstName `<br \/>\n        -Initials '' `<br \/>\n        -LastName $alias.LastName `<br \/>\n        -OrganizationalUnit $OU<br \/>\n<\/code><br \/>\nNow doesn&#8217;t that feel better.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So yeah .. I like things to be neat and clean and having a single line command in powershell is the norm for a lot of people. Example: New-MailContact -DomainController $dc -Name $alias.ContactName -ExternalEmailAddress $alias.ExternalEmailAddress -Alias $alias.ContactAlias -FirstName $alias.FirstName -Initials &#8221; -LastName $alias.LastName -OrganizationalUnit $OU But like stated I like&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/sysadminnightmare.com\/index.php\/2016\/05\/05\/powershell-breaking-a-command-down-to-multi-lines\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2,7,8],"tags":[],"class_list":["post-250","post","type-post","status-publish","format-standard","hentry","category-admin","category-powershell-2","category-tech-tips-101"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bgeE-42","_links":{"self":[{"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/comments?post=250"}],"version-history":[{"count":3,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/posts\/250\/revisions"}],"predecessor-version":[{"id":254,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/posts\/250\/revisions\/254"}],"wp:attachment":[{"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/media?parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/categories?post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/tags?post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}