#Check if the PS profile already exists:
$path = "$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
#If the profile does not exist, create it:
If(-not(Test-Path -path $path))
{
#Create WindowsPowerShell directory for currently logged user.
New-Item $env:USERPROFILE\Documents\WindowsPowerShell\ -Type Directory
#Create PowerShell profile for currently logged user.
New-Item $env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 -Type File
#Import SCCM PowerShell module for for currently logged user.
Add-Content -Value "Import-Module '$($Env:SMS_ADMIN_UI_PATH | Split-Path -Parent)\ConfigurationManager.psd1'" -Path $Profile
#Set the SCCM site location for currently logged user.
Add-Content -Value "Set-Location MB1:" -Path $Profile
}
#Otherwise, do nothing.
Else
{ exit }
Saturday, 28 February 2015
Logon script for importing SCCM PowerShell module
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment