{"id":386,"date":"2013-02-27T14:03:39","date_gmt":"2013-02-27T13:03:39","guid":{"rendered":"http:\/\/wp.rimfalt.se\/?p=386"},"modified":"2013-02-27T14:03:39","modified_gmt":"2013-02-27T13:03:39","slug":"powershell-copy-files-from-unc-and-elevate-to-get-rights","status":"publish","type":"post","link":"https:\/\/wp.rimfalt.se\/?p=386","title":{"rendered":"Powershell &#8211; Copy files from UNC and elevate to get rights"},"content":{"rendered":"<p><a href=\"https:\/\/wp.rimfalt.se\/wp-content\/uploads\/2013\/02\/Install.ps1_.txt\">Install.ps1<\/a><\/p>\n<p>$identity = [Security.Principal.WindowsIdentity]::GetCurrent()<br \/>\n$principal = new-object Security.Principal.WindowsPrincipal $identity<br \/>\nif ($principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -eq $false)<br \/>\n{ $psArgs = &#8217;-noprofile -nologo -executionpolicy bypass -file &#8221;{0}&#8221;&#8217; -f $MyInvocation.MyCommand.Path<br \/>\nStart-Process -FilePath &#8217;powershell.exe&#8217; -ArgumentList $psArgs -Verb RunAs<br \/>\nexit }<\/p>\n<p>$Source = split-path -parent $MyInvocation.MyCommand.Definition<br \/>\n$dest=&#8221;C:\\AXIS Camera Control&#8221;<br \/>\nif (!(Test-Path -path $dest)) {New-Item $dest -Type Directory} # Skapa katalogen om den saknas !<br \/>\nCopy-Item $Source\\filer\\* $Dest -recurse #Kopiera filerna&#8230;<br \/>\nStart-Process -FilePath ($dest + &#8221;\\AXISCameraControlSDK.exe&#8221;) #Starta SDK installationen<br \/>\nregsvr32 ($dest + &#8221;\\AxisCameraControl.ocx&#8221;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install.ps1 $identity = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = new-object Security.Principal.WindowsPrincipal $identity if ($principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -eq $false) { $psArgs = &#8217;-noprofile -nologo -executionpolicy bypass [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[12],"tags":[46,75,110],"class_list":["post-386","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-elevate","tag-powershell","tag-uac"],"_links":{"self":[{"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=\/wp\/v2\/posts\/386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=386"}],"version-history":[{"count":0,"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=\/wp\/v2\/posts\/386\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.rimfalt.se\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}